* $dataProvider=new CActiveDataProvider('Post'); * * $this->widget('zii.widgets.grid.CGridView', array( * 'dataProvider'=>$dataProvider, * )); *
Post
title
create_time
* $this->widget('zii.widgets.grid.CGridView', array( * 'dataProvider'=>$dataProvider, * 'columns'=>array( * 'title', // display the 'title' attribute * 'category.name', // display the 'name' attribute of the 'category' relation * 'content:html', // display the 'content' attribute as purified HTML * array( // display 'create_time' using an expression * 'name'=>'create_time', * 'value'=>'date("M j, Y", $data->create_time)', * ), * array( // display 'author.username' using an expression * 'name'=>'authorName', * 'value'=>'$data->author->username', * ), * array( // display a column with "view", "update" and "delete" buttons * 'class'=>'CButtonColumn', * ), * ), * )); *
$data['create_time']
array('odd', 'even')
$row
$data
$this
$data->property
$data['property']
* ... * 'updateSelector'=>'{page}, {sort}, #mybutton', * ... *
function(xhr, textStatus, errorThrown, errorMessage)
xhr
textStatus
errorThrown
errorMessage
* ... * 'ajaxUpdateError'=>'function(xhr,ts,et,err,id){ $("#"+id).text(err); }', * ... *
function(id,options)
function(id, data)
function(id)
$(gridID).yiiGridView('getSelection')
* ... * 'filterSelector'=>'{filter}, #myfilter', * ... *