<?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/discussion/pager-issues-with-solutions</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/discussion/pager-issues-with-solutions/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Pager Issues (with solutions)</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/pager-issues-with-solutions#p31122</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/pager-issues-with-solutions#p31122</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Â </p>
<p>Thanks for posting this solution.</p>
<p>Â </p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 13 Sep 2014 13:12:23 +0300</pubDate>
        </item>
        <item>
        	<title>vital on Pager Issues (with solutions)</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/pager-issues-with-solutions#p31013</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/pager-issues-with-solutions#p31013</guid>
        	        	<description><![CDATA[<p>For those, who came here from google as i am, an updated solution for newer grid versions should look like:</p>
<div class="sfcode">
<pre class="brush-javascript syntax">onPaging: function(pgButton) {
Â Â Â Â Â Â Â Â Â Â Â  var newpage, last;
Â Â Â Â Â Â Â Â Â Â Â  if ("user" == pgButton) {
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  newpage = parseInt($(this.p.pager).find('input:text').val());
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  last = parseInt($(this).getGridParam("lastpage"));
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  if (newpage &#62; last) {
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  return 'stop';
Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â  }
Â Â Â Â Â Â Â Â Â Â Â  }
Â Â Â Â Â Â Â  },</pre></div>]]></description>
        	        	<pubDate>Tue, 26 Aug 2014 10:06:34 +0300</pubDate>
        </item>
        <item>
        	<title>davidelewis on Pager Issues (with solutions)</title>
        	<link>http://www.trirand.com/blog/?page_id=393/discussion/pager-issues-with-solutions#p2796</link>
        	<category>Discussion</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/discussion/pager-issues-with-solutions#p2796</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='sfselectit2830' value='Select Code' data-codeid='sfcode2830' /></p>
<div class='sfcode' id='sfcode2830'>$("#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><strong>I&#39;d like to suggest that this solution should be incorporated into a future release of jqGrid.</strong></p>
<p>I&#39;ve cross-posted this item in the "Bugs" forum ...</p>
]]></description>
        	        	<pubDate>Wed, 29 Oct 2008 13:18:08 +0200</pubDate>
        </item>
</channel>
</rss>