LigerUi-Js中Grid行修改时,不执行保存事件的原因?(已解决)
(1)
(2)下面代码写在grid上面
function itemclick1(item) { var editingrow = grid.getEditingRow(); switch (item.text) { case "增加": if (editingrow == null) { grid.addEditRow(); } else { LG.tip('请先提交或取消'); } break; case "修改": var selected = grid.getSelected(); if (editingrow == null) { beginEdit() } else { LG.tip("请先提交或取消修改"); } break; case "保存": if (editingrow != null) { alert("保存11"); grid.endEdit(editingrow); } else { LG.tip('现在不在编辑状态'); } break; case "取消": if (editingrow != null) { grid.cancelEdit(editingrow); } else { LG.tip('现在不在编辑状态!'); } break; case "删除": $.ligerDialog.confirm('确定删除吗?', function (confirm) { if (confirm) f_delete(grid, 1); }); break; case "操作按钮": break; } } //加载toolbar var toolbarOptions1 = { items: [ { text: '增加', click: itemclick1, img: "../lib/icons/silkicons/add.png" }, { line: true }, { text: '修改', click: itemclick1, img: "../lib/icons/miniicons/page_edit.gif" }, { line: true }, { text: '保存', click: itemclick1, img: "../lib/icons/silkicons/page_save.png" }, { line: true }, { text: '取消', click: itemclick1, img: "../lib/icons/silkicons/cancel.png" }, { line: true }, { text: '删除', click: itemclick1, img: "../lib/icons/miniicons/page_delete.gif" } ] };
(3)必须写一下代码,否则不能进入(添加,修改之后的)保存方法
//工具条事件 function toolbarBtnItemClick(item) { var editingrow = grid.getEditingRow(); switch (item.id) { case "add": //top.f_addTab(null, '增加角色信息', 'MemberManage/RoleDetail.aspx'); if (editingrow == null) { addNewRow(); } else { LG.tip('请先提交或取消修改'); } break; case "view": var selected = grid.getSelected(); if (!selected) { LG.tip('请选择行!'); return } break; case "modify": var selected = grid.getSelected(); if (!selected) { LG.tip('请选择行!'); return } //top.f_addTab(null, '修改角色信息', 'MemberManage/RoleDetail.aspx?ID=' + selected.RoleID); if (editingrow == null) { beginEdit(); } else { LG.tip('请先提交或取消修改'); } break; case "delete": jQuery.ligerDialog.confirm('确定删除吗?', function (confirm) { if (confirm) f_delete(); }); break; case "save": if (editingrow != null) { grid.endEdit(editingrow); } else { LG.tip('现在不在编辑状态!'); } break; case "cancel": if (editingrow != null) { grid.cancelEdit(editingrow); } else { LG.tip('现在不在编辑状态!'); } break; } }