Gridview Ajax Custom Button Before Send Updating The Cell Value Problem

Am facing the problem of showing the loader.gif beforesend function via ajax in the yii gridview in a particular related cell value. here is my gridview.

<?php $this->widget('zii.widgets.grid.CGridView', array(






    array('header'=>'Valid Till','name'=>'valid','value'=>$data->valid),



                    'name' => 'status',


                    'filter' => $active,'sortable'=>TRUE,
















  'mail' => array




  'url'=>'Yii::app()->createUrl("deals/sendmail", array("id"=>$data->id))',

  'options' => array( 'ajax' => array('url'=>'js:$(this).attr("href")',


 $("ordering_.'$data->id'.").replaceWith("<td id=\"ordering_'.$data->id.'\"><img src=\"/images/loading.gif\"></td>");

                                                                'success'=>'function(data){$(".status").html("Mail Sent Successfully.")









)); ?>

The main problem is that the $data->id in beforesend function returns blank.So i cant update that TD cell value

Maybe $data isnt initialized?

$data->id is displaying in the grid columns but not showing in ajax:beforesend function??

$data is available only to certain CButtonColumn’s buttons property options. Actually to url and visible only. You can’t use it neither in beforeSend nor in any other option except url and visible.

I was facing the same problem with label option of CButtonColumn’s buttons [size=“2”]property[/size][size=“2”], where wanted to use $data, but it is unavailable there.[/size]

[size=“2”]This is, basically, because url and visible options are treated as PHP expressions, that are being evaluated with PHP’s eval() function, while are other options are taken directly – either as string or array.[/size]