JQGrid pager says “1 of Nan”?

故事扮演 提交于 2019-12-08 08:37:07

问题


When I have no rows returned, our jqGrid pager says Page 1 of NaN.

The JSON returned is:

{"page":"1","records":"0","total":"1"}

Why is NaN listed?


Update: We only seem to have this issue when we use loadonce:true.

Here's the source code:

  $("#list").jqGrid({
    url:'NoData.json',
    datatype: 'json',
    mtype: 'GET',
    colNames:['Product', 'Type'],
    colModel :[
      {name:'product', index:'product', width:80},
      {name:'type', index:'type', width:55, align:'right'},
    ],
    pager: '#pager',
    rowNum:20,
    viewrecords: true ,
    caption: 'Positions',
    height: '460',
    loadonce:true,          
    hidegrid: false         
  });

Update 2: What seems to work is the JSON below - is this right?

{"page":0,"records":0,"total":0,"rows":[]}

回答1:


Something is wrong in the definition of your jqGrid. Look at the simple example of jqGrid filled with your JSON data. You will see "No records to view" ar other text from $.jgrid.defaults.emptyrecords defined in grid.locale-XX.js (grid.locale-en.js for example).

If you will continue to have problem you should append your question with the code of the jqGrid having the described problem.




回答2:


It's trying to reference the first page of a recordset with no records.




回答3:


How about change the option "pgtext"?

pgtext: "Page {0}"


来源:https://stackoverflow.com/questions/3755396/jqgrid-pager-says-1-of-nan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!