jquery - Yii gridview ajax custom button before send updating the cell value -


am facing problem of showing loader.gif beforesend function via ajax in yii gridview in particular related cell value. here gridview.

<?php $this->widget('zii.widgets.grid.cgridview', array( 'id'=>'deals-grid', 'dataprovider'=>$model->mersearch(),  'columns'=>array(     'title',     'description',     array('header'=>'valid till','name'=>'valid','value'=>$data->valid),     array('name' => 'status',                 'value'=>array($this,'getstatus'),                 'filter' => $active,'sortable'=>true,                 'htmloptions'=>array('class'=>'status'),                 ),     array             (                'name'=>'image',                  'type'=>'image',                             'value'=>array($this,'imagepath'),                             'htmloptions'=>array('class'=>'thumb','rel'=>'gallery'),             ),  array( 'class'=>'cbuttoncolumn', 'buttons'=>array (    'mail' => array     (      'label'=>'mail',   'imageurl'=>yii::app()->request->baseurl.'/images/mail.png',   'url'=>'yii::app()->createurl("deals/sendmail", array("id"=>$data->id))',   'options' => array( 'ajax' => array('url'=>'js:$(this).attr("href")', 'beforesend'=>'function(){  var obj= $(".mail");   obj.parent().parent().find(".status").replacewith("<td class=\"status\"><img src=\"/images/loading.gif\"></td>");}',                                                                 'success'=>'function(data){$(".status").html("mail sent successfully.")                                                                     }',                                     ),                                                      'class'=>'mail',                                     )),                                           ),          'template'=>'{update}{delete}{mail}',     ), ), )); ?> 

the main problem when click on sendmail button replace parent status class cell loading.gif want replace row status cell replaced not all.

when use

var obj= $(".mail");

you cells, because each 1 of them have class "mail".

you should 1 clicked. try

var obj= $(this);

i didn't tested, it's idea.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -