MVC結合DWZ選中列表批量刪除

1、刪除按鈕

<a title="確實要刪除選中記錄嗎?" callback="dialogAjaxCUDResult" target="selectedTodo" postType="string"href="@Url.Action("DeleteDtail", "Order", new {OrderId = @orderModel.OrderId})"  class="delete" ><span>批量刪除</span></a>

2、列表複選框設置

<th width="5%" align="center"><input type="checkbox" group="ids" class="checkboxCtrl"></th>
 <td><input name="ids" type="checkbox" value="@order.Id"></td>

注意:ajax

一、group="ids"和name="ids"保持一致json

二、dwz會將複選框的值做爲參數傳給DeleteDtail方法post

3、C#接收參數

public JsonResult DeleteDtail(Guid orderId, int orderTypeId,string ids)

4、處理後臺返回的json

一、後臺返回的json數據將在dialogAjaxCUDResult中獲得處理。dialogAjaxCUDResult能夠隨便定義。ui

function dialogAjaxCUDResult(data) {
    //若是會話超時會作出跳轉到登陸頁面
    DWZ.ajaxDone(data);
    if (data.Result == true) {
        navTabPageBreak();
    }
    switch (data.OpTag) {
        //刪除訂單全部詳情
        case "deleteOrderDetail":
            if (data.Result == true) {
                alertMsg.correct("刪除成功");
                //刪除當前頁
                navTab.closeTab(data.CloseTable);
                //刷新列表
                navTab.reloadFlag(data.navTabId);
                navTab.reload(data.forwardUrl);
            } else {
                alertMsg.error("刪除失敗");
            }
            break;
    }
相關文章
相關標籤/搜索