php - Regarding the updating of CGridViews in TbRelationalColumn view -
in tbrelationalcolumn view page, have javascript refreshes sub-grid in view on click of action button. if user opens multiple sub-grids, grid update work first opened sub-grid.
i think because grid id not unique subgrids. can please help?
$this->widget('bootstrap.widgets.tbgridview', array ( 'id'=>'main-grid', ... 'columns'=>array ( array('header'=>'sl no','value'=>'$this->grid->dataprovider->pagination->currentpage * $this->grid->dataprovider->pagination->pagesize + ($row+1)', 'headerhtmloptions'=>array('style' =>'text-align: center;'), 'htmloptions'=> array('style'=>'text-align: center;')), array ( 'name'=>'indent_no', 'header'=>'indent no', 'class'=>'bootstrap.widgets.tbrelationalcolumn', 'url' => $this->createurl('indent/view'), 'afterajaxupdate' => 'js:function(tr,rowid,data){}' ),
indent/view contents:
<?php $this->widget('bootstrap.widgets.tbgridview', array ( 'id'=>'sub-grid', 'dataprovider'=>indent::model()->searchindenteditems($id), "ajaxupdate"=>true, 'template'=>"{items}", 'filter'=>null, 'columns'=>array ( array ( 'header' => 'actions', 'class'=>'cbuttoncolumn', 'template'=>'{block} ', 'buttons' => array ( 'block'=>array ( 'url' =>'yii::app()->createurl("indent/block", array("id"=>$data->id))', 'imageurl'=>yii::app()->request->baseurl.'/images/block.jpg', 'options'=>array(''), 'click'=>"function(){ $.ajax({'type':'post', 'url':$(this).attr('href'), 'success':function(data){ if ( data.substring(1,8) != 'success') { alert(data); } else { $.fn.yiigridview.update('sub-grid'); } exit; }, 'error':function(xhr, status, error){ alert(xhr.responsetext);exit; }}); return false;}", 'visible'=> '($data->indented_item_status == "active") && user::model()->checkaccess("block indented item")?"1":"0";', ), ), ) ) ) ); ?>
Comments
Post a Comment