EasyUI弹窗批量修改combogrid下拉框的值

匿名 (未验证) 提交于 2019-12-03 00:41:02

       //点击弹出批量修改框           UpdateLot: function () {             var row = $("#dg").datagrid("getChecked");             if (row.length < 1) {                 toastr.warning("请先选择要修改的记录");                 return;             }              $('#UpdateLot').modal('show');         },          //显示弹框中下拉框的数据         showList: function () {              $('#txtTerminalID').combogrid({                 //panelWidth: 500,                 idField: 'TerminalID', //ID字段                   textField: 'TerminalID', //显示的字段                   fitColumns: true,                 editable: false,                  columns: [[                     { field: 'TerminalID', title: '终端ID', sortable: true, width: 100 },                     { field: 'Name', title: '名称', sortable: true, width: 150 }                 ]],                 onSelect: function (index, row) {                     reloadadr(row.TerminalID);                 }, onLoadSuccess: function () {                     //默认选中第一行                           $('#txtTerminalID').combogrid('grid').datagrid('selectRow', 0);                 }             });             $('#txtADRCode').combogrid({                 idField: 'ADRCode',                 textField: 'ADRCode',                 editable: false,                 columns: [[                    { field: 'TerminalID', title: '终端ID', sortable: true, width: 100 },                     { field: 'ADRCode', title: '地址码', sortable: true, width: 150 }                 ]],                 onLoadSuccess: function () {                     //默认选中第一行                           $('#txtADRCode').combogrid('grid').datagrid('selectRow', 0);                 }             });              $.post("/Pile/GetDataById?id=" + 0, function (data) {                 var editdata = $.parseJSON(data);                 reloadte(1);                 $('#txtSite_ID').combogrid('setValue', 1);                 $('#txtTerminalID').combogrid('setValue', editdata[0].TerminalID);                 $('#txtADRCode').combogrid('setValue', editdata[0].ADRCode);              });         },         UpteLot: function () {             var parmId = "";             var TerminalID = $("#txtTerminalID").combogrid("getValue").toString();             var ADRCode = $("#txtADRCode").combogrid("getValue").toString();             var rows = $("#dg").datagrid("getChecked");             //循环遍历要修改的ID             $.each(rows, function (i, row) {                 parmId += row.ID + ",";             });                  $.ajax({                 url: "/Pile/UpdatePile",                 data: {                     IDs: parmId,                     TerminalID: TerminalID,                     ADRCode: ADRCode,                 },                          type: "POST",                 dataType: "json",                 success: function (data) {                     if (data.errortype==true) {                         // 成功后的操作                                                window.location.href = "/Pile/Index";                     }                     else {                         toastr.error(data.result);                     }                 }              });         }

          public ActionResult UpdatePile()         {             string parmIds = Request["IDs"];             string TerminalID = Request["TerminalID"];             string ADRCode = Request["ADRCode"];              string strsql = string.Format("update AppCHCPile set TerminalID='{0}',ADRCode='{1}' where ID in ({2})", TerminalID, ADRCode, parmIds.TrimEnd(','));             //将获得的数据作JSON对象抛回             var data = new             {                 errortype = YLSBLL.BLLComm.SqlExec(strsql),              };             return Json(data, JsonRequestBehavior.AllowGet);          }

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!