hi experts,
when I ran the php page,and it threw the exception "Undefined variable: data "
<script type="text/javascript">
function dock(x,y){
alert(x+ ' '+y);
}
</script>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$model->search(),
'filter'=>$model,'hideHeader'=>false,
'columns'=>array(
array(
'class'=>'CCheckBoxColumn',
'selectableRows'=>'2',
'checked'=>'false',
'checkBoxHtmlOptions'=>array('name'=>'selectdel[]'),
'headerHtmlOptions'=>array('width'=>'50px','value'=>'','checked'=>false)
),
array(
'name'=>'title',
'type'=>'raw',
'value'=>'CHtml::link(CHtml::encode($data->title), $data->url)'
),
array(
'header'=>'action',
'class'=>'CButtonColumn',
'template'=>'{update} {delete} {recommend}',
'buttons'=>array(
'update'=>array(
'visible'=>'Yii::app()->user->checkAccess("Edit Post")',
'title'=>'update'
),
'delete'=>array(
'visible'=>'1',
'title'=>'delet',
'options'=>array('style'=>'padding-left:10px;'),
),
'recommend' => array(
'label'=>'mybutton', // text label of the button
'click'=>"function(){dock('$data->id','2');}",
),
),
),
),
)); ?>