<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: Loadonce with data refresh: sort not remembered</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/loadonce-with-data-refresh-sort-not-remembered-1</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/help/loadonce-with-data-refresh-sort-not-remembered-1/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>thepenguinwhisperer on Loadonce with data refresh: sort not remembered</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/loadonce-with-data-refresh-sort-not-remembered-1#p29043</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/loadonce-with-data-refresh-sort-not-remembered-1#p29043</guid>
        	        	<description><![CDATA[<p>Hi all,</p>
</p>
<p>I am using jqGrid with loadonce:true.</p>
<p>The data is reloaded every 60 seconds.</p>
<p>However after the data is reloaded the sorting is back to the default.</p>
</p>
<p>I have tried doing this:</p>
<pre class="lang-xml prettyprint prettyprinted">Reloading the data from the serverside<br /><p><input type='button' class='sfcodeselect' name='sfselectit200' value='Select Code' data-codeid='sfcode200' /></p><div class='sfcode' id='sfcode200'>$(&#39;#list1&#39;).jqGrid(&#39;setGridParam&#39;, { url:&#39;data.php&#39;, datatype:&#39;xml&#39; }).trigger(&#39;reloadGrid&#39;);</div><br />In the grid definition:<br /><br />
<p><input type='button' class='sfcodeselect' name='sfselectit5165' value='Select Code' data-codeid='sfcode5165' /></p><div class='sfcode' id='sfcode5165'>
<pre class=&#34;&#34;&#34;lang-xml&#34;&#34;><div class=&#34;&#34;sfcode&#34;&#34;>loadComplete : function() {
    jQuery(&#34;#list1&#34;).jqGrid(&#39;setGridParam&#39;,{datatype:&#39;local&#39;});
    jQuery(&#34;#list1&#34;).jqGrid(&#39;setGridParam&#39;,{sortname:&#39;name&#39;,sortorder:&#39;desc&#39;}).trigger(&#39;reloadGrid&#39;);
                    }</div></pre>
</div>
<p>This doesn&#39;t work. Using this instead of the second line in loadComplete before:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4780' value='Select Code' data-codeid='sfcode4780' /></p>
<div class='sfcode' id='sfcode4780'>
<pre class=&#34;&#34;&#34;lang-js&#34;&#34;><div class=&#34;&#34;sfcode&#34;&#34;>setTimeout(function () {
            $self.triggerHandler(&#34;reloadGrid&#34;);
        }, 50);</div></pre>
</div>
<p>This does sort the table again.<br />There are 2 downsides which I would like to get rid of:<br />- 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%.<br />- 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.<br />Is there a way to sort the data in the background to the column I want and only "reshow" it once that is finished?</p>
<p>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?</p>
<p>I have been searching the internet however at the moment it&#39;s not working out.<br />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.</p>
<p>Also more in the future I could "cache" the xml so it doesn&#39;t has to be regenerated over and over again on each update.</p>
<p>Thanks in advance! I&#39;m really hoping someone can help me here!</p>
<p>EDIT: please move to jqGrid :s</p>
]]></description>
        	        	<pubDate>Thu, 20 Jun 2013 18:53:16 +0300</pubDate>
        </item>
</channel>
</rss>