CGridView widget已具有查看,更新_view文件中CViewList小窗口鏈接,DETE option.But我用我的基於jQuery Mobile的項目CListView中小部件,但在創建AJAX鏈接刪除選項有問題。不知道如何在_view.php(視圖文件)和它的renderPartial()視圖文件中創建一個ajax刪除鏈接,以在成功刪除plz幫助之後消失該欄。這是用於編輯和刪除的_view.php文件鏈接。如何創建Ajax刪除
<?php
echo CHtml::link(CHtml::encode($data->id),
array('editmember1', 'id' => $data->id),
array('data-role' => 'button', 'data-icon' => 'star')
);
echo CHtml::link(CHtml::encode($data->id), $this->createUrl('customer/delete', array('id' => $data->id)),
array(
// for htmlOptions
'onclick' => ' {' . CHtml::ajax(array(
'beforeSend' => 'js:function(){if(confirm("Are you sure you want to delete?"))return true;else return false;}',
'success' => "js:function(html){ alert('removed'); }")) .
'return false;}', // returning false prevents the default navigation to another url on a new page
'class' => 'delete-icon',
'id' => 'x' . $data->id)
);
>
鏈接幾乎是罰款,你想完成什麼? –
@ bool.dev其未刪除的記錄,在顯示任何錯誤:( – Coder
確定,目前鍵入答案 –