Forum



00:46

14/05/2010

I am still trying to understand how jqGrid works. I have managed to load data into my grid from the server, and I've managed to get it to sort, but I can't get the paging to work. What I would like is to download all the data from the server at once, but only have some of it displayed in the grid. Then I would like to be able to sort the data in the grid and also page forwards and backwards. Is this possible? It looks as if I have to use the loadComplete function to change the datatype to "local" or the sorting won't work (it keeps trying to go back to the server), but then clicking the paging buttons just resorts the data instead of paging.
Maybe I am missing something simple? Thank you very much for your help! Here is my Javascript:
jQuery("#list").jqGrid({
url:MyURL,
datatype: 'xml',
loadComplete : function () {
jQuery("#list").jqGrid('setGridParam',{datatype:'local'});
},
mtype: 'GET',
colNames:['Inv No','Amount','Tax','Notes'],
colModel :[
{name:'invid', index:'invid', width:100},
{name:'amount', index:'amount', width:80, align:'right'},
{name:'tax', index:'tax', width:80, align:'right'},
{name:'note', index:'note', width:150, sortable:true}
],
pager: $('#pager'),
rowNum:3,
rowList:[3,6,9],
sortname: 'invid',
sortorder: 'desc',
viewrecords: true,
caption: 'My first grid'
})
and here is the XML (total of 7 rows):
<?xml version='1.0' encoding='utf-8'?>
<rows>
<page>1</page>
<total>1</total>
<records>2</records>
<row id='1'>
<cell>101</cell>
<cell>500.00</cell>
<cell>15.00</cell>
<cell>Testing</cell>
</row>
...
<row id='7'>
<cell>107</cell>
<cell>700.00</cell>
<cell>70.00</cell>
<cell>Testing7</cell>
</row>
</rows>
20:00

Moderators
30/10/2007

Hello,
This work is just in alfa stage and you can test it here:
http://github.com/tonytomov/jq.....d/tree/dev
Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
73 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66