【发布时间】:2011-04-17 21:02:31
【问题描述】:
我们使用自定义格式化程序来输出 html 表单文本框。如果用户输入了数据并点击了下一个/上一个按钮,我们想告诉他们“您已编辑数据,点击确定以留在此页面并保存您的数据”。你怎么能这样做?
使用分页器时会触发“onPaging”事件,但它似乎无法阻止分页发生。
更新:当前解决方法:
var currPg = 1;
var dirty = 'false';
$("#list").jqGrid({
...
onPaging: function (b) {
var nextPg = $("#list").getGridParam("page");
if (dirty == 'false') {
currPg = nextPg;
return;
}
$( "#dialog-confirm" ).dialog({
modal: true,
buttons: {
"Stay on current page": function() {
$( this ).dialog( "close" );
},
"Change page": function() {
$( this ).dialog( "close" );
reloadGrid($("#list"), null, nextPg, 'false');
}
}
});
$("#list").setGridParam({page:currPg}); //Workaround - jqGrid still increments the page num even when we return stop so we have to reset it (and track the current page num)
return 'stop';
},
更新 2:已记录错误 here。
【问题讨论】:
标签: jquery jqgrid pagination pager