jquery - 当全选单击时,Jqgrid 数据未保存在已编辑的行上
问题描述
我像这样使用 Jqgrid:
$("#grdMain" + TabID).jqGrid({
datatype: 'local',
colNames: ['ID', 'LookupCode','LookupTitle'],
colModel: [
{ name: 'ID', index: 'ID', hidden: true, editable: true, dataType: "number" },
{ name: 'LookupCode', index: 'LookupCode', hidden: true },
{ name: 'LookupTitle', index: 'LookupTitle', width: 100 }],
localReader: {
repeatitems: false,
cell: "",
id: "ID"
},
scrollOffset: 20,
rowNum: 20,
rowList: [10, 20],
sortorder: 'asc',
viewrecords: true,
autowidth: false,
gridview: true,
forceFit: false,
shrinkToFit: false,
multiselect: true,
width: 1255,
height: 340,
editurl: 'clientArray',
rowNum: 1000000,
direction: 'rtl',
caption: '',
gridstate: 'hidden',
rownumbers: true,
loadError: ServiceFailed,
onSelectRow: function (rowid, isSelected) {
$(this).editRow(rowid, true);
$("#" + rowid + "_LookupTitle", "#grdMain" + TabID).lookup();
},
beforeSelectRow: function (rowid, e) {
return DetailGridUtility.SaveDetail($(this), rowid, LastID);
}, onSelectAll: function (ids, status) {
}
});
假设网格上有 10 行,我选择了 2 个第一行,第二行处于编辑模式,我更改了 lookupTitle (并且行仍处于编辑模式),现在我单击“全选复选框”,然后更改为第二行不考虑编辑模式
我该如何解决这个错误?
selectAll之前有方法吗?(如果有,我可以为 SellectAll 保存更改)
解决方案
我解决了。我找到了 selectAll 复选框标记并为 mousedown 事件编写了函数并在此方法上保存了网格。此事件调用之前复选标记所有行。我无法使用 Click 事件或 change 事件,因为这些事件在选中所有行后调用
$("#cb_grdMain" + TabID).mousedown(function () {
//Save Grid
});
推荐阅读
- git - Git 未提交的文件
- ios - 动画多个 UIViews alpha
- timestamp - 在 AutoHotkey 中获取毫秒
- java - JavaFX:TableView Cell 像素化 ImageView - 如何撤消转换?
- c - C:我是不是传错了字符串?
- algorithm - 2个序列之间的最佳映射
- python-2.7 - Issue with duplicate values generated when using factory_boy and randint
- sql - oracle sql中星号的使用
- ace-editor - Ace Editor (1.4.3) 在按下 [enter] 时在错误的列上断线
- python-3.x - 发送带有内嵌图像的电子邮件 Flask-Mail?