0

Here append similar questions but I cannot find answer to my one:

In html is table id= grid and div id=pager:

Also I have mine js code:

     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.

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 i.e 10 (value less than rows number)per page I always see in my navigator:

page 1 of 5

and I cannot switch it to another it always stays on first

json info:

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

thanks in advance Radek

Vik David
  • 3,640
  • 4
  • 21
  • 29
radek
  • 1,203
  • 1
  • 12
  • 16
  • 1
    I suppose that the origin of the problem are the wrong JSON data in the server response. Could you include the JSON data which you receive from the server in case of wrong "page 1 of 5" information in the pager? To catch HTTP traffic you can use [Fiddler](http://www.fiddler2.com/fiddler2/), [Firebug](http://getfirebug.com/) or just "Network" tab of Developer Tool of Internet Explorer (press F12) or Google Chrome. – Oleg Mar 04 '12 at 11:11
  • I've edit edmy questions – radek Mar 04 '12 at 11:14
  • if you returns total: 5 then jqGrid displays "page 1 of 5". You should just calculate the `total` value base on the input `rows` parameter which represent the number of rows per page. If row equal to 28 for example you should place 3 as the `total` value. – Oleg Mar 04 '12 at 11:23
  • 2
    Look at [the old answer](http://stackoverflow.com/a/5766189/315935) where I tried to describe how jqGrid uses "total", "page" and "records" properties from the JSON response. If you have problems with implementation of server-side paging on the server side you can just return **all data** in JSON response and use `loadonce: true` jqGrid option. In the case the paging, sorting and filtering of the data will be implemented *locally*. – Oleg Mar 04 '12 at 11:43

1 Answers1

0

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.

Lance Harper
  • 2,216
  • 14
  • 11
  • Yes I can control it bt i don't know how to set the property total. Honestly I haven't heard about "total" till now – radek Mar 04 '12 at 10:59