jqgrid json on load rownumbers negative
I am loading a grid and setting rownum given how much room I have to show records in the window; more or less with the following parameters:
height:howhi - 32,
width:howWideToBe,
rowNum: howhiRownum,
loadonce : true,
sortable: true,
sortname: 'NPSQrtlyActivity',
sortorder: 'desc',
shrinkToFit: true,
pager:'#gridpager',
rownumbers: true,
imgpath: 'themes/redmond/images',
caption:'Site Accounts',
ignoreCase: true,
viewrecords: true,
scrollOffset: 25,
shrinkToFit:true,
altRows:true,
altclass:"myAltRowClass",
mtype: 'GET',
beforeSelectRow: function(rowid, e) {return false;},
hoverrows:false
The data is populated via json data from server (php) as
$i=0;
while($row = mssql_fetch_array($result)) {
$responce->rows[$i]['id']=$row[15];
$responce->rows[$i]['cell']=array($row[0],$row[1],$row[2],$row[3],$row[4],$row[5],$row[6],$row[7],$row[8],$row[9],$row[10],$row[11],$row[12],$row[13],$row[14],$row[15],$row[16]);
$i++;
} echo json_encode($responce);
Well, the json response seems fine
{"rows":[{"id":"1-13JLCF","cell":["XXX XXXX XXX","Crawley","RH10 1SS","IAM","128",24,".$$_$$$$$$_$",1,5.23,"\u00a3 ","4200","27900","4650","51.106236","-0.104152","1-13JLCF","XXX XXXX XXX"]},{"id":"1-2EU55","cell":["YYY YYYY YYY","London","W12 7SB","Comms","140",21,"$_$_$$$$$$_$",1,5.17,"\u00a3 ","2750","8250","1550","51.291181","-0.235997","1-2EU55","YYY YYYY YYY"]},
snip
@Oleg: the end of the json response is no开发者_Go百科 different to the beginning. Ie there is no other envelope information such as
"page":"0″,"total":1,"records":"3″
The problem is I get the weird negative rownumbers and the 0 page on the pager.
Moreover, if I hit enter in the filter toolbar search; doing an empty search, the json response remains the same but the rownumbers and pagination are now correct.
You don't posted the code of jqGrid which you use, so I can only guess what is your problem.
I suppose that you use negative rowNum
value (for example rowNum:-1
). It is not allowed, but follows to no error if you get the data from the server, if the server code has no problem with the value and if you not use loadonce:true
property of jqGrid. Because you have negative row numbers I suppose that you do use loadonce:true
parameter. If it is your problem you can fix it changing rowNum:-1
to rowNum:10000
for example.
精彩评论