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:
|
1 2 3 4 5 6 |
Reloading the data from the serverside<br /><code>$('#list1').jqGrid('setGridParam', { url:'data.php', datatype:'xml' }).trigger('reloadGrid');</code><br />In the grid definition:<br /><br /><br /> <div class="sfcode"><br /> <pre class="""lang-xml""><div class=""sfcode"">loadComplete : function() {<br /> jQuery("#list1").jqGrid('setGridParam',{datatype:'local'});<br /> jQuery("#list1").jqGrid('setGridParam',{sortname:'name',sortorder:'desc'}).trigger('reloadGrid');<br /> }</div> |
This doesn't work. Using this instead of the second line in loadComplete before:
|
1 2 3 |
<div class=""sfcode"">setTimeout(function () {<br /> $self.triggerHandler("reloadGrid");<br /> }, 50);</div> |
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
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top