mctreegridview A modification of cqtreeview,combining treeview and cgridview with filter search enabled

  1. Requirements
  2. Usage
  3. Resources

this extension combines treeview in a gridview with a fully working filter search

Requirements

Yii 1.1 or above

Usage

1.Generate a model

  1. Add the widget to yourview

3.Download extension from downloads and upload into the extensions folder

//instead of zii.widgets.grid.CGridView a new extension CQTreeGridView is used here
$this->widget('ext.QTreeGridView.CQTreeGridView', array(
	'id'=>'category-grid',
	// 'cssFile'=>false,
	'ajaxUpdate' => false,
	'dataProvider'=>$dataProvider,
	'filter'=>$model,
	'columns'=>array(
		'id',
		'name',
		'description',
		//'icon',
		//'parent_id',
		array(
			'name' => 'parent_id',
			'value'=>'(($data->parent_id==0)?"No Parent" :$data->parentCategory->name)',
		),
		array(
			'class'=>'CButtonColumn',
			'template'=>'{view}{update}{delete}',
			'buttons'=>array
    		(
		         
             
		),
	),
	),
)); 

4.In your Controller

$model=new Category('search');
		 $dataProvider=new CActiveDataProvider('Category');
		 
		 $criteria = new CDbCriteria();
		
		$model->unsetAttributes();  // clear any default values
		if(isset($_GET['Category']))
		{

			   foreach($_GET['Category'] as $key=>$value) {
			   		$criteria -> compare($key, $value, true, 'AND');
			   }
			   $dataProvider = new CActiveDataProvider('Category', array('criteria' => $criteria));
		}
			
		$this->render('admin',array(
			'model'=>$model,'dataProvider'=>$dataProvider
		));

Resources

qtreeview extension original source in russian

6 1
16 followers
1 710 downloads
Yii Version: Unknown
License: (not set)
Category: User Interface
Developed by: shafi
Created on: May 26, 2013
Last updated: 4 years ago

Downloads

show all

Related Extensions