jqGrid 阻止寻呼机导航?

发布于 2024-09-25 06:29:11 字数 1389 浏览 6 评论 0原文

我们使用自定义格式化程序来输出 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:记录错误此处

We use a custom formatter to output html form text boxes. In the case that a user has entered in data and they hit the next/prev button, we want to tell them "you've edited data, hit ok to stay on this page and save your data". How can you do this?

The 'onPaging' event fires when you use the pager but it doesn't seem to let you prevent the pagination from occuring.


Update: Current workaround:

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';
    },

Update 2: Bug logged here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情愿 2024-10-02 06:29:11

如果函数 onPaging 返回“stop”,则分页将被停止。

If the function onPaging returns 'stop' then the pagination will be stopped.

你好,陌生人 2024-10-02 06:29:11

根据我的观察,onPaging 事件在最新的 jqgrid 插件中运行良好。虽然如果我们使用以前的 jqgrid 插件(3.8 版本之前)。onPaging 事件将起作用,但是,在我们使用此事件后分页中存在错误。因为它会自动增加页面的值用户单击“确定”或“取消”(在这两种情况下)。这会导致分页数据损坏。

As per my observation onPaging event works well in latest jqgrid plugin.While if we use previous jqgrid plugin ( before 3.8 version).onPaging event will work but,there is bug in pagination after we use this event.As it automatically increment value of page either user click on ok or cancel(in both cases).Which lead to corrupt data of paggination.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文