CTreeView

Hi dears,

How to implement the CTreeview based on CMenu structure.

Thnaks

If I understand you correctly you want to build CTreeview widget and fill it with the same positions as you have in your menu, right?

Well I’m afraid there isn’t any other option like doing this yourself, manually. You have to iterate through CMenu.items and pick out of each item information that will be required to render treeview item and manually add it to a new array. Then you have to create CTreeview widget and fill it’s data property with new array you just created.

Take a look at Yii source files, how CMenu.renderMenuRecursively method is implemented, this can be a good help to iterate through whole menu items. All you have to do from this point is to write similar function or even copy the original one, remove all unnecessary in your situation code and add some new code to generate new array in format CTreeview.data will accept.