<?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: sortGrid breaking pagination?</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination</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/bugs/sortgrid-breaking-pagination/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on sortGrid breaking pagination?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30658</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30658</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>The reload parameter if set to false does not reload the grid only if you are in the same sortname and same sortorder - this mean is your current grid setting is : column1 and the sortorder is asc, the grid will not be reloaded only if you </p>
<p><input type='button' class='sfcodeselect' name='sfselectit334' value='Select Code' data-codeid='sfcode334' /></p>
<div class='sfcode' id='sfcode334'>
$('#grid').jqGrid('sortGrid','column1',false,'asc');
</div>
<p>In all other cases you will got with reloading.<br />
Please look <a href="http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods" target="_blank">here</a></p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Thu, 22 May 2014 14:38:37 +0300</pubDate>
        </item>
        <item>
        	<title>dmittner on sortGrid breaking pagination?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30648</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30648</guid>
        	        	<description><![CDATA[<p>Here&#39;s a jsFiddle with an example of the problem.</p>
<p><a href="http://jsfiddle.net/Jq2HR/" target="_blank">http://jsfiddle.net/Jq2HR/</a></p>
</p>
<p>In making that I learned that the issue only exists when sortGrid is executed within the loadComplete event handler. If it&#39;s executed separately then subequent navigation works fine. So whatever is happening that&#39;s messing up the behavior must be running internally after the loadComplete event fires, but since that&#39;s the last event in the data loading process, there&#39;s no option for me to execute sortGrid any later.</p>
</p>
<p>The only remaining option I can think of would be to set a timeout in loadComplete to execute sortGrid after jqGrid is finished doing whatever it does after that event. Seeing as though I&#39;m just trying to fix a subtle visual this is a possibility, but might fall out of sync if a user paginates quickly, so clearly not ideal.</p>
</p>
<p>IMO the best solution would be for jqGrid to support server-side sorting defining. So if the server provides sort/order variables (or whatever is defined in prmNames) in the response, those will automatically overwrite whatever jqGrid already thinks sorting is. The server being the authorative source over how the data is actually sorted, it makes sense that it could tell jqGrid that for proper presenation. I actually expected this behavior to exist already and have returned sorting information this whole time...</p>
]]></description>
        	        	<pubDate>Tue, 20 May 2014 20:51:42 +0300</pubDate>
        </item>
        <item>
        	<title>admin on sortGrid breaking pagination?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30640</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30640</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>Can you please post a simple demostration?</p>
<p>Thank you</p>
</p>
<p>Kind Regards</p>
]]></description>
        	        	<pubDate>Tue, 20 May 2014 12:15:16 +0300</pubDate>
        </item>
        <item>
        	<title>dmittner on sortGrid breaking pagination?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30637</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30637</guid>
        	        	<description><![CDATA[<blockquote>
<p>The idea to call sortGrid in loadComplete event is very dangerous. You will go to infity loop.</p>
</blockquote>
<p>No it won&#39;t. The second parameter is whether you want it to initiate a reload. I specifically mentioned above that I use this to avoid an infinite loop.</p>
<blockquote>
<p>I think the best idea for this purpose is to use setGridParam to change the sortname parameter and sortorder one.</p>
</blockquote>
<p>Been there, tried that. setGridParam doesn&#39;t initiate any visual change to the column headers, which is what I&#39;m trying to solve.</p>
]]></description>
        	        	<pubDate>Mon, 19 May 2014 18:43:27 +0300</pubDate>
        </item>
        <item>
        	<title>tony on sortGrid breaking pagination?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30635</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30635</guid>
        	        	<description><![CDATA[<p>Hello,</p>
</p>
<p>The idea to call sortGrid in loadComplete event is very dangerous. You will go to infity loop.</p>
<p>The reason for this is that sorGrid call again populate . When you populate you call loadComplete, which call again sortGrid and so on.</p>
</p>
<p>I think the best idea for this purpose is to use setGridParam to change the sortname parameter and sortorder one.</p>
</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Mon, 19 May 2014 14:03:21 +0300</pubDate>
        </item>
        <item>
        	<title>dmittner on sortGrid breaking pagination?</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30629</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/sortgrid-breaking-pagination#p30629</guid>
        	        	<description><![CDATA[<p>So one problem lead to a solution that ended up causing another problem...</p>
</p>
<p><strong>Problem #1:</strong></p>
<p>My columns can vary from load to load so I hide/show them accordingly, but also adjust the sorting to a column that&#39;s valid on the backend. So if the previously sorted column no longer applies, a new one is chosen. However, jqGrid doesn&#39;t look for sorting variables in responses for the column header visuals to update.</p>
</p>
<p><strong>Solution:</strong></p>
<p>Within loadComplete I do: grid.jqGrid(&#39;sortGrid&#39;, data.sortBy, false, data.sortOrder.toLowerCase());</p>
<p>Obviously I don&#39;t want to unnecessarily loop things, so a reload isn&#39;t performed as part of this command.</p>
</p>
<p><strong>Problem #2 <em>(and bug)</em>:</strong></p>
<p>Now what&#39;s happening is that the typical pagination controls aren&#39;t working. It won&#39;t advance beyond page 2. If I had to guess I&#39;d say that the sortGrid method causes an internal page variable to reset to page 1. So while the visual still shows page 2, an attempt to move forward one page or backwards doesn&#39;t work because it thinks it&#39;s on page 1 already.</p>
<p>Thus, these work:</p>
<ul>
<li>Manually entering a page number / hitting enter</li>
<li>Using the arrow control to go directly to the last page</li>
</ul>
<p>And these don&#39;t:</p>
<ul>
<li>Incrementing up one page</li>
<li>Decrementing down one page</li>
<li>Going directly to the first page</li>
</ul>
<p>All those behaviors make sense if you assume the logic thinks it&#39;s already on page one, which I&#39;d put forth is the bug.</p>
]]></description>
        	        	<pubDate>Sun, 18 May 2014 02:16:30 +0300</pubDate>
        </item>
</channel>
</rss>