如何从JQGrid分页器获取页码? [英] How to get the page number from the JQGrid Paginator?

查看:684
本文介绍了如何从JQGrid分页器获取页码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有JQGrid.如果我想从分页的页码文本框中捕获用户输入,我该怎么办?而且我也想在网格更改页面之前执行此操作.

I have JQGrid in my application. If i wanted to capture the user input from Pagination's page number text box, what i have to do? And also i wanted to do it before grid changes it's page.

有什么办法吗?拜托,有人帮我实现这个.

Is there any way to do it? Please, somebody help me to implement this.

推荐答案

您可以使用 onPaging 回调如果需要,您可以停止页面的更改.如果是直接用户输入,则callback参数将为字符串"user".要获取当前值,可以使用page参数,也可以直接从输入控件获取或设置值

You can use onPaging callback If is's needed you can event stop changing of the page. In case of direct user input the parameter of callback will be the string "user". To get the current value you can use either page parameter or get or set the value directly from the input control

onPaging: function (pgButton) {
    var pagerId = this.p.pager.substr(1); // ger paper id like "pager"
    var newValue = $('input.ui-pg-input', "#pg_" + $.jgrid.jqID(pagerId)).val();
        // newValue is in the most cases the same as in this.p.page
        // only wrong values like -10 entered by user will not update
        // "page" parameter
    if (pgButton === "user" && newValue > 2) { // some tests
        return "stop";
    }
}

更新:免费jqGrid 没有描述的内容以上问题.参见维基文章描述了onPaging回调的其他options参数,该参数具有newPagecurrentPage和其他一些属性.

UPDATED: Free jqGrid don't have the described above problem. See the wiki article which describes additional options parameter of onPaging callback, which has newPage, currentPage and some other properties.

这篇关于如何从JQGrid分页器获取页码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆