mtreeview CTreeView++.

  1. Requirements
  2. Usage
  3. Upgrade Instructions
  4. Example
  5. Links
  6. References (aside from Yii docs)

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!

Requirements

Yii 1.1.7 and above (not tested with 1.1.6 and below,so I'm not sure whether it'll work there)

Usage

Download the latest MTreeView_2.1.zip and extract to extensions folder.

Click here to view all releases or MTreeView

Refer here to view all the available options for MTreeView.

Upgrade Instructions

If you are already using the initial release of MTreeView, all you have to do is replace the MTreeView.php. There should be no problem encountered after the update, but just to be sure, just rename the old MTreeView.php. Please report any errors which will be encountered at our discussion page.

For more detailed explanation about this extension, visit my blog or download the latest sample zip file to play with the extension. The new sample zip file can be used with the sample database for version 1.1 (mtreeview_1.1.sql).

Example

$this->widget('application.extensions.MTreeView.MTreeView',array(
		'collapsed'=>true,
		'animated'=>'fast',
		//---MTreeView options from here
		'table'=>'menu_adjacency',//what table the menu would come from
		'hierModel'=>'adjacency',//hierarchy model of the table
		'conditions'=>array('visible=:visible',array(':visible'=>1)),//other conditions if any                                    
		'fields'=>array(//declaration of fields
			'text'=>'title',//no `text` column, use `title` instead
			'alt'=>false,//skip using `alt` column
			'id_parent'=>'parent_id',//no `id_parent` column,use `parent_id` instead
			'task'=>false,
			'icon'=>false,
			'url'=>array('/menuAdjacency/view',array('id'=>'id'))
		),
	));

Download the latest sample ZIP file for examples of usage and further details.

Links

Join Discussion

More Detailed Explanation

References (aside from Yii docs)

http://stackoverflow.com/questions/841014/nested-sets-php-array-and-transformation

http://semlabs.co.uk/journal/converting-nested-set-model-data-in-to-multi-dimensional-arrays-in-php

http://www.fliquidstudios.com/2008/12/23/nested-set-in-mysql/

http://snipplr.com/view/4383/build-nested-array-from-sql/

24 2
27 followers
8 464 downloads
Yii Version: 1.1
License: MIT
Category: User Interface
Developed by: morcen
Created on: Jul 10, 2011
Last updated: 12 years ago

Downloads

show all

Related Extensions