Hi guys, i have problem with my gridview.
my grid contain buttoncolumn for two function, update and delete row.
this is my gridview
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'cart-grid',
'summaryText'=>'Terdapat {count} item pada keranjang anda.',
'dataProvider'=>$dataProvider,
'columns'=>array(
array('header'=>'No','value'=>'$row+1','htmlOptions'=>array('style'=>'text-align:center;color:#83B705;')),
array('header'=>'Kode Produk', 'value'=>'$data["kdPrd"]'),
array('header'=>'Ukuran','value'=>'$data["ukuran"]','footer'=>'Total'),
array('header'=>'Jumlah','value'=>'$data["jml"]','footer'=>(count($list)==0)?0:$tJml),
array('header'=>'Harga Satuan','value'=>'number_format($data["harga"],2,",",".")','footer'=>(count($list)==0)?0:number_format($tHarga,2,',','.')),
array('header'=>'Total','value'=>'number_format($data["total"],2,",",".")','footer'=>(count($list)==0)?0:number_format($tTotal,2,',','.')),
array(
'class'=>'CButtonColumn',
'template'=>'{edit}{hapus}',
'buttons'=>array(
'hapus'=>array(
'imageUrl'=>Yii::app()->baseUrl.'/images/deletered.png',
'click'=>'function(){
$("#confirm-delete").dialog("open");
$("#kdPrd-del").val($(this).parent().parent().children(":nth-child(2)").text());
return false;
}',
),
'edit'=>array(
'imageUrl'=>Yii::app()->baseUrl.'/images/edit.png',
'click'=>'function(){
$("#edit-detail").dialog("open");
$("#kdPrd").val($(this).parent().parent().children(":nth-child(2)").text());
$("#ukuran").val($(this).parent().parent().children(":nth-child(3)").text());
$("#jumlah").val($(this).parent().parent().children(":nth-child(4)").text());
return false;
}',
)
)
),
),
));
i calling dialog for update data, and for delete confirmation.
this my edit dialog
<?php $this->beginWidget('zii.widgets.jui.CJuiDialog',array(
'id'=>'edit-detail',
'options'=>array(
'resizable'=>false,
'modal'=>true,
'title'=>'Edit',
'autoOpen'=>false,
'buttons'=>array(
'OK'=>'js:function(){
$.ajax({
type:"post",
data:"kdPrd="+$("#kdPrd").val()+"&jumlah="+$("#jumlah").val()+
"&ukuran="+$("#ukuran").val(),
url:"'.CController::createUrl('UpdateItemPesan').'",
success:function()
{
$(".item-pesan").load("'.CController::createUrl('renderCart').'");
$("#edit-detail").dialog("close");
}
}
);
}',
'CANCEL'=>'js:function(){$(this).dialog("close")}'
)
)
));?>
and delete dialog confirmation
<?php $this->beginWidget('zii.widgets.jui.CJuiDialog',array(
'id'=>'confirm-delete',
'options'=>array(
'resizable'=>false,
'modal'=>true,
'title'=>'Edit',
'autoOpen'=>false,
'buttons'=>array(
'OK'=>'js:function(){
$.ajax({
type:"post",
data:"kdPrd="+$("#kdPrd-del").val(),
url:"'.CController::createUrl('deleteItem').'",
success:function()
{
$(".item-pesan").load("'.CController::createUrl('renderCart').'");
$("#confirm-delete").dialog("close");
}
}
);
}',
'CANCEL'=>'js:function(){$(this).dialog("close")}'
)
)
));
?>
my problem is delete function not work after update function execute,
or after one row deleted.
I don’t know what to do, please help me
sorry for my english language