Author Topic: totalPages display NaN  (Read 1890 times)

msdnweixiao

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 21
    • View Profile
totalPages display NaN
« on: November 06, 2020, 12:17:09 pm »
in the gird init method,  i used pageModel like this:
pageModel:{type:"remote", curPage:1, totalPages:1, rPP:1000, rPPOptions:[1000,5000,10000]}

and don't set data.

but totalPages display NaN, what should i do ?


var Grid1_obj = {
height:'100%-70',
showTitle:false,
stripeRows:true,
collapsible:{on:false,toggle:false},
showTop:true,
showBottom:true,
sortable:true,
selectionModel:{type: 'cell', mode: 'block'},
scrollModel:{autoFit: false},
virtualX:true,
virtualY:true,
groupModel:Grid1_cols.groupModel,
contextMenu: {
on: true,
cellItems: Grid1_bodyItems},
sortModel: {
type: 'remote',
single: true,
space: true,
multiKey: null
},
rowInit:function( ui ){
var rowData = ui.rowData;
var fcolor = rowData.FCOLOR;
if (!fcolor) {
fcolor = rowData.fcolor;
}
if (fcolor) {
return { cls: fcolor};}
},
resizable:false,
wrap:false,
hwrap:false,
numberCell:{show: true, resizable: true, title: "#"},
colModel:Grid1_cols.pqCols,
pageModel:{type:"remote", curPage:1, totalPages:1, rPP:1000, rPPOptions:[1000,5000,10000,50000]},
rowBorders:true
};
$('#Grid1_GRID').pqGrid(Grid1_obj);

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: totalPages display NaN
« Reply #1 on: November 06, 2020, 01:28:06 pm »

msdnweixiao

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: totalPages display NaN
« Reply #2 on: November 06, 2020, 02:41:16 pm »
i add dataModel like this:

var Grid1_dataModel = {
 location: 'local',
 data: []
};

var Grid1_obj = {
.........
dataModel:Grid1_dataModel,
pageModel:{type:"remote", curPage:1, totalPages:1, rPP:1000, rPPOptions:[1000,5000,10000,50000]},
};

$('#Grid1_GRID').pqGrid(Grid1_obj);

but totalPages still display NaN, why?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: totalPages display NaN
« Reply #3 on: November 06, 2020, 03:08:36 pm »
You can't use local data with remote paging.

What exactly is your goal. Do you want to set up local or remote paging?

pageModel.type = "remote" and dataModel.location = "remote" are used if you have implemented remote paging on the server side.

Remote paging example is here: https://paramquery.com/pro/demos/paging

If you haven't implemented server side paging, then set pageModel.type = "local"

msdnweixiao

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: totalPages display NaN
« Reply #4 on: November 06, 2020, 03:35:34 pm »
yeah, set dataModel.location = "remote", totalPages  display 1, that's perfect.   thank you .