简体   繁体   English

jQuery,jqgrid分页:无法切换页面

[英]jquery, jqgrid paging: cannot switch page

Here append similar questions but I cannot find answer to my one: 在此附加类似的问题,但我找不到我的答案:

In html is table id= grid and div id=pager: 在html中,表格id =网格和div id = pager:

Also I have mine js code: 我也有我的js代码:

     var myGrid = $("#grid").jqGrid({

            url: _options.gridFetch,
           datatype: "json",

            colModel:[
                {name:'id',index:'id', width:55},
                {name:'name',index:'name', width:555, editable:true},
                {name:'is_promoted',index:'is_promoted', width:165, editable:true, formatter: $.adminCategoryEntries._boolFormatter, edittype: 'select', editoptions:{value:"1:Yes;0:No"}},
                {name:'is_in_shop',index:'is_in_shop', width:165, editable:true, formatter: $.adminCategoryEntries._boolFormatter, edittype: 'select', editoptions:{value:"1:Yes;0:No"}},
                {name:'actions', formatter:'actions', width: 85, formatoptions:{keys:true}}, 
           ],

            pager: '#pager',
            jsonReader : { repeatitems: false } ,
            rowNum: 10,

            rowList: [10, 20, 500],

            viewrecords: true,

            autowidth: true,

            sortname: 'id',

            sortorder: 'desc'

        });

        myGrid.jqGrid('navGrid','#pager',{edit:false,add:false,del:false,search:false});

I've use code from other stackoverflow tutorial. 我使用了其他stackoverflow教程中的代码。

And here is my issue: If I try to change number of showed rows in my navigator I can see all stored data (86 rows) but if I set rows to ie 10 (value less than rows number)per page I always see in my navigator: 这是我的问题:如果我尝试更改导航器中显示的行数,我可以看到所有存储的数据(86行),但是如果我将行设置为ie,即每页10个(值小于行数),我总是会看到航海家:

page 1 of 5 第1页,共5页

and I cannot switch it to another it always stays on first 我无法将其切换到另一个,它始终保持在第一位

json info: json信息:

>page: 1
>records: "86"
>rows: [{id:3, name:Ulkofilee/Naudanliha, is_promoted:1, is_in_shop:1},…]
>total: 5

thanks in advance Radek 在此先感谢Radek

Are you getting the data from a server method you can control? 您是否从可以控制的服务器方法获取数据? It's somewhat cryptic, but the data coming from your _options.gridFetch needs to have a property named "total" defined that specifies the current page that should be viewed. 它有点神秘,但是来自_options.gridFetch的数据需要定义一个名为“ total”的属性,该属性指定应查看的当前页面。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM