Yii Framework Forum: Why Cannot Invoke Js Function With Parameters Of Customed Button In Cgridview - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Why Cannot Invoke Js Function With Parameters Of Customed Button In Cgridview CGridView customed Rate Topic: -----

#1 User is offline   jbas 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 04-October 12

Posted 21 January 2013 - 10:02 PM

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}&nbsp;{delete}&nbsp;{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');}",
                    ),   

			),
		),

	),
)); ?>

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users