【发布时间】:2013-03-08 12:12:19
【问题描述】:
我有一个带有寻呼机的网格。我需要阻止寻呼机加载另一个页面,而当前页面上的一行正在进行内联编辑。所以当我创建网格时,我定义了 onPaging 函数
....
onPaging : function(){
if (inEdit()>0){
alert("Finish editing the current line");
return 'stop';
}
}
....
inEdit 函数只计算有多少行有 attr 可编辑。
这可以完成这项工作,但是稍后当我在分页停止时正在编辑的行上调用 restoreRow 函数时,该函数无法将该行恢复到以前的状态。
稍后编辑:
稍后调用此函数取消编辑时会出现问题
function cancelEdit(id){
/*this line does nothing at all --> */ $('#list').jqGrid('restoreRow',id);
//The only way restore worked is by calling a grid reload but that is not really a solution
$('#list').trigger("reloadGrid", [{page:$('#list')[0].p.page}]);
$('#'+id+' [name=editButton]').show();
$('#'+id+' [name=submitButton]').hide();
$('#'+id+' [name=cancelButton]').hide();
}
PS:编辑/保存/取消/删除是自定义按钮
【问题讨论】:
-
您是从服务器向您的网格提供数据吗?其他人正在编辑您的网格中显示的数据的用例吗?
-
目前,数据是在本地加载的,问题不在于其他人编辑数据,而是在网格中您必须一次只能编辑1行并且只能停止通过保存或取消(确认)网格的所有其他功能进行编辑,这可能会中断编辑,例如分页必须停止,直到编辑完成。
-
你解决了吗?
标签: jqgrid