Cgridview And Ajax Dismiss Button

I’m using the CGridView to display a list of Alerts. I have at the end of each row a view and a dismiss buttons. I was wondering how can I get the dismiss button to work with Ajax and not having to refresh the page every time I dismiss an alert (which is what it’s doing right now)?

following is my code:

array(

     'class'=>'CButtonColumn',


     'template' => '{view}',


     'viewButtonUrl'=>'Yii::app()->createUrl("issue/view", array("id" => $data["object_id"]))',


   //  'updateButtonUrl'=>'Yii::app()->createUrl("/vehicle/update", array("id" =>  $data["id"]))',


     'header' => 'View',


     'viewButtonImageUrl'=>'images/view.png',


  ),


  


  array(


 'header'      => 'Dismiss',


     'type'        => 'html',


     'value'       => 'CHtml::link(CHtml::image("images/alert_dismiss.png", "Dismiss", array("title"=>"Dismiss")), array("dashboard/dismissAlert", "id"=>$data->id, ))',


     'filter'      => VFFormUtil::getFilter(VFFormUtil::ISSUE_SEVERITY),


     'htmlOptions' => array('style'=>'text-align: center; width: 60px'),


  ),

…anyway, I figured out the answer…thanks!

array(

    'class'=>'CButtonColumn',


    'template'=>'{delete}',


    'deleteButtonImageUrl'=>Yii::app()->request->baseUrl.'/images/delete.png',


    'deleteButtonUrl'=>'Yii::app()->createUrl("dashboard/dismissAlert", array("id"=>$data->id))',  


    'htmlOptions' => array('style'=>'text-align: center; width: 60px'),  


    


   )

Hi,

u can try the below code…


array(

			'class'=>'CButtonColumn',

			'template'=>{'update','delete'},

			'buttons'=>array('delete'=>

		                     array(

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

                             	'label'=>'delete',

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

                             		'confirm'=>$alert,

                                        'class'=>'grid_action_set',

	                                 'ajax'=>array(

                                       'type'=>'POST',

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

	                                   'success'=>'function(data){

                             							if(data == "true"){

                             									$.fn.yiiGridView.update("liquor-category-grid");

                             									return false;

                             							}else{

                             									window.location="admin?del=exist";

                             									return false;

                             							}

                             					}',

	                                   

	                                 ),

                               ),

                            ),

                            'update'=>array(

                                        'options'=>array('class'=>'grid_action_set'),

                                   ),

                        ),        

         

			//'buttons'=>UtilityHtml::getGridButtonAjax1($formId, $gridId, $modelName),

		),