MTreeView
CTreeView++

MTreeView extends CTreeView, which displays a tree view of hierarchical data. It can handle both nested set and adjacency hierarchy model,and can create a linked node and adds icon if you wish. It can also be used to render AJAX tree!

Edit:
I have updated the extension to version 1.1, wherein nodes can have their individual 'htmlOptions'. Visit my blog or the extensions page to download the latest zip files and to know the details of the updates.

- added the option 'encode' (bool), which will CHtml::encode() the node if set to true
- edited some codes
- changed the template default to {icon} {text}" (added space in between)
- removed the field 'position' as one of the selected field to avoid errors in query
- fixed the indentation. Proper indentation is lost when file is opened in other editors such as Notepad++.
- redeclared the static variables to its default values so as not to affect other MTreeView especially when rendered in a single page.
- allowed declaring of array in url, just like that in Yii::app()->createUrl(). 'url' field can be declared in array in the format array(string $route,array $params). $params is in ('field name'=>'field that has the value') format, like ('id'=>'id').(NOTE: cannot be used in AJAX tree.)

- added the option 'encode' (bool), which will CHtml::encode() the node if set to true
- edited some codes
- changed the template default to {icon} {text}" (added space in between)
- removed the field 'position' as one of the selected field to avoid errors in query
- fixed the indentation. Proper indentation is lost when file is opened in other editors such as Notepad++.
- redeclared the static variables to its default values so as not to affect other MTreeView especially when rendered in a single page.
- allowed declaring of array in url, just like that in Yii::app()->createUrl(). 'url' field can be declared in array in the format array(string $route,array $params). $params is in ('field name'=>'field that has the value') format, like ('id'=>'id').(NOTE: cannot be used in AJAX tree.)

Please test the new release if you have time.

Thanks macinville - the url stuff works great.

Just one little error - in redeclaring the static template, you use the old version.

I'm quite new to YII and started using MTreeView to display/manage a collection of folders and files.
My two models are properly built and relationed (giix did a great job...) and displaying them using MTree was a joke.
I have problems putting ajax links tough, hope you could advice.

Like this, eveything works as expectd. Now, I would like to populate the XLSDetails div with folder or file data, depending on which tree node was clicked, with data taken from respective '_view' partials.
Not to mention populating target div with data from two different models, I couldn't find a working way to populate the div at all!
I've tried adding a 'fields' array (as per the example) but it didn't work.
I've tried adding code to my controller's method (as per http://www.yiiframew...ctreeview-node/) but it didn't work either.

What would you (or anybody else with more experience than me) suggest?

Thanks for your great extension (it did teach me different things!).
Cheers,
rash*

I managed to build url into nodes (I do this inside my controller) and they do work, so a folder node gets a url like:

xlsfolder/view&id=2

while files get:

xlsfile/view&id=3

I've also monitored ajax calls/responses with firebug and everything works fine.
Then I tried to implement another solution (again by you, http://www.yiiframew...dpost__p__94249) but as soon as I call createLinks my tree goes blank and firebug shows no more ajax stuff; this happens at root (source) level, right away.

After a lot of searching and reading and browsing code, I've realized MTree is oversized and not tailored to my needs.
Still, it's been interesting because looking at the code made me find the right way, I believe.
What I need is to 'downgrade' my tree to CTreeView and build links within my controller: to this, MTree code is more than inspiring!
So thank you Macinville, I took lesson one!

So sorry I have been busy with my personal projects (not Yii-related) that I was not even able to check my email or update my blog for the past few months. Anyway, I'm glad that MTreeView has somehow helped you. So glad to be of help.

Fiddling around with Yii 1.1.10 and MTreeView 2.1, I ran into a problem where the Yii debugger (thanks for that!) kept telling me there was either an array-to-string error, or an unknown array item, in CUrlManager. After some digging and a lot of experimentation, I figured out what I think is the cause.