Forum
18:53
20/05/2013
Hi all,
I am using jqGrid with loadonce:true.
The data is reloaded every 60 seconds.
However after the data is reloaded the sorting is back to the default.
I have tried doing this:
Reloading the data from the serverside$('#list1').jqGrid('setGridParam', { url:'data.php', datatype:'xml' }).trigger('reloadGrid');
In the grid definition:
loadComplete : function() { jQuery("#list1").jqGrid('setGridParam',{datatype:'local'}); jQuery("#list1").jqGrid('setGridParam',{sortname:'name',sortorder:'desc'}).trigger('reloadGrid'); }This doesn't work. Using this instead of the second line in loadComplete before:
setTimeout(function () { $self.triggerHandler("reloadGrid"); }, 50);This does sort the table again.
There are 2 downsides which I would like to get rid of:
- If you have a scrollbar in the grid, when scrolled down, it immediately resets to the beginning. As a workaround I would use height: 100%.
- If the data is reloaded, there is a short amount of time where the table is shown in the state it is retrieved in the xml data. After that it is sorted.
Is there a way to sort the data in the background to the column I want and only "reshow" it once that is finished?Is there a way that instead of jqGrid generating the whole grid again, it is going through the current grid, using the indexes from the order they are in now and update each lines data?
I have been searching the internet however at the moment it's not working out.
If you wonder why I use loadonce: I want to reduce the server load as much as possible and keep the sorting, searching, ... on the client.Also more in the future I could "cache" the xml so it doesn't has to be regenerated over and over again on each update.
Thanks in advance! I'm really hoping someone can help me here!
EDIT: please move to jqGrid :s
Most Users Ever Online: 715
Currently Online:
20 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