ajax refresh in custom cbuttoncolumn

Hi,

I am trying to make a new button for a cgridview, that functions like the delete button (I’m using logical delete).

So far I have a button which calls the action fine and updates the row, but I can’t get it to update the gridview…


  	   $buttonArray = array(

			'class'=>'CButtonColumn',

			'template'=>'{view}{update}{undelete}',

			   'buttons'=>array('undelete'=>

			     array(

			        'url'=>'Yii::app()->controller->createUrl("Undelete",array("id"=>$data->primaryKey))',

			        'label'=>'undelete',

				    'imageUrl'=>Yii::app()->request->baseUrl.'/assets/8b5a3370/gridview/delete.png',

					'options'=>array(  // this is the 'html' array but we specify the 'ajax' element

			         'ajax'=>array(

			           'type'=>'POST',

			           'url'=>"js:$(this).attr('href')", // ajax post will use 'url' specified above

			           'update'=>'product-grid',

			           'click'=>'function(){alert("hello?");}',

			         ),

			       ),

			    ),

			),			  

		); 

the ‘click’ function doesn’t call either. What am I missing here??

thanks

IIRC, there’s no ‘ajax’ available in the CButtonColumn property buttons.

You can use the click handler to call $.fn.yiiGridView.update (IIRC)

Edit: Also move ‘click’ out of ‘options’

/Tommy