<?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: Setting page number to 1 when changing page length</title>
	<link>http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length</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/feature-request/setting-page-number-to-1-when-changing-page-length/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Setting page number to 1 when changing page length</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p9269</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p9269</guid>
        	        	<description><![CDATA[<p>Hello Oleg,</p>
<p>Done. Thanks.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Thu, 03 Sep 2009 10:11:45 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on Setting page number to 1 when changing page length</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p9250</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p9250</guid>
        	        	<description><![CDATA[<p>Hi Tony,</p>
</p>
<p>A small remark. In the current version on GitHub the lines 816 and 817 in grid.base.js should be swaped. Correct code should be:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ...<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; $(&#39;.ui-pg-selbox&#39;,"#"+pgcnt).bind(&#39;change&#39;,function() { <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ts.p.rowNum = this.value;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ...</p>
<p>Best regards</p>
<p>Oleg</p>
]]></description>
        	        	<pubDate>Thu, 03 Sep 2009 03:38:43 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Setting page number to 1 when changing page length</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p9142</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p9142</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thanks Oleg - this definitley usefull. Will make some tests and include in the next releases.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Mon, 31 Aug 2009 10:55:07 +0300</pubDate>
        </item>
        <item>
        	<title>OlegK on Setting page number to 1 when changing page length</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p8924</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p8924</guid>
        	        	<description><![CDATA[<p>Hello edallen!</p>
</p>
<p>I wanted to post following in the "bugs" part of forum, but after read your mail I deceide to make it here. It seems to me, that my solution is a little better.</p>
</p>
<p>I suggest insert in grid.base.js between lines 802 and 803:</p>
<p>$(&#39;.ui-pg-selbox&#39;,"#"+pgcnt).bind(&#39;change&#39;,function() { <br />&#160;&#160;&#160; ts.p.rowNum = this.value;</p>
<p>following new line</p>
<p>&#160;&#160;&#160; ts.p.page = Math.round(ts.p.rowNum*(ts.p.page-1)/this.value-0.5)+1;</p>
<p>(ts.p.rowNum*(ts.p.page-1) - is the number of rows currently skiped.</p>
<p>&#160;ts.p.rowNum*(ts.p.page-1)/this.value - is the number of pages which sould be skipt, but as a float number. Math.round(x-0.5) is truncation instead of round. And +1 at the end becasue we count bages begins with 1)</p>
<p>I describe shortly what problem fixes the line.</p>
<p>Let as we have a grid with pager und rowList=[10,20,100]. At the beginning the first 10 rows of the data loaded and displayed. User press 2 times the button &#8220;next page&#8221; and stay on page 3 from 5 totally. Now user decides to scroll better in 20 steps or in 100 steps. He changes pager size (rowNum) from 10 to 20 or 100 and receive a message, that there are no data to display. The reason was that after changing the pager size (rowNum), the current page number (page) stays unchanged and so will be requested from server to load data from the wrong page. To fix the problem one should either reset page value to 1 or recomputed the page value.</p>
</p>
<p>Regards</p>
<p>Oleg</p>
]]></description>
        	        	<pubDate>Sat, 22 Aug 2009 10:34:10 +0300</pubDate>
        </item>
        <item>
        	<title>edallen on Setting page number to 1 when changing page length</title>
        	<link>http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p8756</link>
        	<category>Feature Request</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/feature-request/setting-page-number-to-1-when-changing-page-length#p8756</guid>
        	        	<description><![CDATA[<p>I made this change to my grid.base.js of beta 3.5. Haven&#39;t updated yet to 3.5.2 to see if anything similar is there. Basically we wanted the page to always reset to page one when length was changed, to avoid mismatch situations. You might want something similar as a configurable option.</p>
</p>
<p>$(&#39;.ui-pg-selbox&#39;,&#8221;#&#8221;+pgcnt).bind(&#39;change&#39;,function() { <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ts.p.rowNum = this.value;<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // Begin change<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $(&#39;input.ui-pg-input&#39;).val(1);<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; ts.p.page = 1;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; // End change<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; clearVals(&#39;records&#39;);<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; populate();<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; return false;<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; });</p>
]]></description>
        	        	<pubDate>Tue, 18 Aug 2009 16:44:21 +0300</pubDate>
        </item>
</channel>
</rss>