<?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: Pager Issues (with solutions)</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/pager-issues-with-solutions-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/bugs/pager-issues-with-solutions-1/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>davidelewis on Pager Issues (with solutions)</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/pager-issues-with-solutions-1#p2850</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/pager-issues-with-solutions-1#p2850</guid>
        	        	<description><![CDATA[<p>Well ... perhaps it could be available as an option - something like:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6851' value='Select Code' data-codeid='sfcode6851' /></p>
<div class='sfcode' id='sfcode6851'>jQuery(<span class="codestring">"#grid_id"</span>).navGrid(<span class="codestring">"#pager"</span>,{standard parameters}).validateParams(true);</div>
<pre><img class="spSmiley" style="margin:0" title="Smile" src="/blog/wp-content/plugins/simple-forum/tinymce/plugins/emotions/img/smiley-smile.gif" border="0" alt="Smile" /></pre>
]]></description>
        	        	<pubDate>Fri, 31 Oct 2008 12:09:16 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Pager Issues (with solutions)</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/pager-issues-with-solutions-1#p2821</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/pager-issues-with-solutions-1#p2821</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thank you very much for this code.</p>
<p>I will think If I implement this - the reason is simple.</p>
<p>If you known that your table does not change the number of records for</p>
<p>long time this approach is OK, but in real world this is not true.</p>
<p>Imagine the user open a grid and stay&#160; for a long time to let say</p>
<p>page 3 (from 10 total). It is unknown how many pages we will have after</p>
<p>some time. It is possible to have 5 or 15 total pages.</p>
<p>So I prefer to check this server side.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 31 Oct 2008 01:22:28 +0200</pubDate>
        </item>
        <item>
        	<title>davidelewis on Pager Issues (with solutions)</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/pager-issues-with-solutions-1#p2797</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/pager-issues-with-solutions-1#p2797</guid>
        	        	<description><![CDATA[<p>I&#39;ve discovered two minor (but annoying!) issues with the pager component:</p>
<ol>
<li>The interface allows a user to manually select a page number that is greater than the "current" last page.</li>
<li>The interface does not update the last page when the number of rows per pages is adjusted such that the last page will exceed the number of records.</li>
</ol>
<p>Although both of these issues <span style="text-decoration: underline;">can</span> be corrected with the server-side code that generates the row listing - this is not always possible (depends on how the server side implementation works). Therefore, I have added additional code to the "client" so that these issues are resolved before the request is made to the server:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1300' value='Select Code' data-codeid='sfcode1300' /></p>
<div class='sfcode' id='sfcode1300'>$("#grid").jqGrid({<br />&#160; onPaging: function (pgButton) {<br />&#160;&#160;&#160; // if user has entered page number<br />&#160;&#160;&#160; if ("user" == pgButton) {<br />&#160;&#160;&#160;&#160;&#160; // find out the requested and last page<br />&#160;&#160;&#160;&#160;&#160; var requestedPage = $("#grid").getGridParam("page");<br />&#160;&#160;&#160;&#160;&#160; var lastPage = $("#grid").getGridParam("lastpage");<br />&#160;&#160;&#160;&#160;&#160; // if the requested page is higher than the last page value <br />&#160;&#160;&#160;&#160;&#160; if (eval(requestedPage) &#62; eval(lastPage)) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; // set the requested page to the last page value<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; $("#grid").setGridParam({page: lastPage});<br />&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160; // otherwise, if the number of records per page has changed<br />&#160;&#160;&#160;&#160;&#160; } else if ("records" == pgButton) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; // find out the requested page, totolal number of rows, and rows per page<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var requestedPage = $("#grid").getGridParam("page");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var totalRows = $("#grid").getGridParam("records");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var rowsPerPage = $("#grid").getGridParam("rowNum");<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; // calculate what last page SHOULD be<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var lastPage = Math.ceil(eval(totalRows) / eval(rowsPerPage));<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; // if the requested page is greater than what the last page should be <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (eval(requestedPage) &#62; lastPage) {<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // set the requested page to the last page value<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; $("#grid").setGridParam({page: lastPage});<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160; }<br />&#160;&#160;&#160;&#160;&#160; ...<br />&#160;&#160;&#160; }<br />&#160; }<br />});</div>
</p>
<p><strong>I&#39;d like to suggest that this solution be incorporated into a future release of jqGrid.</strong></p>
<p>I&#39;ve cross-posted this item in the "Discussion" forum ...</p>
]]></description>
        	        	<pubDate>Wed, 29 Oct 2008 13:18:09 +0200</pubDate>
        </item>
</channel>
</rss>