<?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: Bug for pager</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager</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/bug-for-pager/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Bug for pager</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6341</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6341</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Thanks for the link. That is the reason that I say that this should be done server side - diffrent SQL serveres - diffrent behaviours, diffrent optimizations. <img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/plugins/simple-forum/tinymce/plugins/emotions/img/smiley-wink.gif" border="0" alt="Wink" /></p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Tue, 28 Apr 2009 08:01:34 +0300</pubDate>
        </item>
        <item>
        	<title>foo on Bug for pager</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6317</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6317</guid>
        	        	<description><![CDATA[<p>No it does not, but please see my edited post.</p>
<p>I&#39;ll provide a working example soon as I&#39;ve finalized it. <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
<p>EDIT: What I am saying is that whilst you are getting i.e. 10 records <em>back</em>, the SQL engine has to actually consider rows * page records in order to provide you with these 10 records.</p>
<p>Unless you say &#8220;give me 10 records back fullfilling my order by criteria, <em>starting </em>from a row which fullfills the criteria for the first row in the page that I have found and stored to help optimize this query&#8221;.</p>
<p>Also when I say "table" I mean a recordset returned to the application-server, which it can use to query the database, <strong>if</strong> the filter and (multicolumn) order hasn&#39;t changed.</p></p>
]]></description>
        	        	<pubDate>Sun, 26 Apr 2009 14:59:44 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Bug for pager</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6316</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6316</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>To continue with this</p>
<p>$limit = $_REQUEST[&#39;rows&#39;]; // the limit of rows</p>
<p>$start = $limit*$page - $limit; // the page from previous post</p>
<p>$SQL = "SELECT ... LIMIT ".$start." , ".$limit; 😉&#160; - not a milion here</p>
<p>Hope that MSSQL have such feature</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Sun, 26 Apr 2009 14:56:40 +0300</pubDate>
        </item>
        <item>
        	<title>foo on Bug for pager</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6314</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6314</guid>
        	        	<description><![CDATA[<p>Yes, your solution fetches all rows to the application-server, then paginates them there before sending the records to the client.</p>
<p>I&#39;m talking about fetching only the n records from page m, from the database-server, as quickly from page 1 as from page 10 million.</p>
<p>I&#39;ll explain better what I mean later. <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
<p>EDIT: I had a look at it, and although MySQL has a LIMIT-clause, there is nothing which indicates to me that it doesn&#39;t scan the rows.</p>
<p>As described here: <a href="http://www.mysqlperformanceblog.com/2006/09/01/order-by-limit-performance-optimization/" rel="nofollow" target="_blank"><a href="http://www.mysqlperformanceblo" rel="nofollow">http://www.mysqlperformanceblo</a>.....imization/</a></p>
<p>"Also note - number of records scanned to provide result set will be very dynamic based on particular constant and other factors.<br /> For example for our dating example if we use only (last_online) index and look for people from USA we likely will find 10 people pretty quickly, if the country is small or simply there are few members from the country, ie Slovenia - same kind of search might <strong>need to scan 1000s times more rows</strong> to provide result set."</p>
<p>My work-around is to create a table holding the order-fields-for-first-row-in-each-page, and use that together with indexes.</p>
<p>Indexes do not alone provide an optimal solution in the case of pagination.</p>
]]></description>
        	        	<pubDate>Sun, 26 Apr 2009 13:09:29 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Bug for pager</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6306</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6306</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I do not think that it is so complicated. Look at demo server.php (PHP variant)</p>
<p>Here I do</p>
<p>$page = $_REQUEST[&#39;page&#39;]; // get the requested page</p>
<p>$limit = $_REQUEST[&#39;rows&#39;]; // get how many rows we want to have into the grid</p>
<p>then get the total records</p>
<p>$result = mysql_query("HERE THE SQL");</p>
<p>$row = mysql_fetch_array($result,MYSQL_ASSOC); // fetch data</p>
<p>$count = $row[&#39;count&#39;]; // at end the count</p>
<p>&#160;if( $count &#62;0 ) {<br />&#160;&#160;&#160;&#160; &#160;&#160;&#160; $total_pages = ceil($count/$limit); // how many total pages we should<br />&#160;} else {<br />&#160;&#160;&#160; &#160;&#160;&#160; $total_pages = 0;<br />}</p>
<p>And the simple logic</p>
<p>if ($page &#62; $total_pages) $page=$total_pages; // HERE WE ARE</p>
</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sun, 26 Apr 2009 06:21:53 +0300</pubDate>
        </item>
        <item>
        	<title>foo on Bug for pager</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6301</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6301</guid>
        	        	<description><![CDATA[<p>Well that was a laugh and a half.</p>
<p>To do <em>actual</em>&#160; pagination on the database-level, as opposed to table-scan, you have to do some acrobatics.</p>
<p>For SQL Server:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit2185' value='Select Code' data-codeid='sfcode2185' /></p>
<div class='sfcode' id='sfcode2185'>
<p>select top (<br />&#160;&#160;&#160; &#160;&#160;&#160; case <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; when @total_rows % (@requested_rows * @requested_page) - @requested_rows &#62; 0 then @total_rows % (@requested_rows * @requested_page) - @requested_rows<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; else @requested_rows<br />&#160;&#160;&#160; &#160;&#160;&#160; end<br />&#160;&#160;&#160; ) *<br />from<br />&#160;&#160;&#160; (<br />&#160;&#160;&#160; &#160;&#160;&#160; select *<br />&#160;&#160;&#160; &#160;&#160;&#160; from<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; (<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; select top (@requested_rows) row_number () over (ORDER BY some_column desc) as nrow<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; , other_columns&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; from some_tables<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; ) as sub<br />&#160;&#160;&#160; &#160;&#160;&#160; where 0 = 0<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; and <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; (<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; (<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; nrow between ((@requested_page - 1) * @requested_rows + 1) <br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; and (@requested_page * @requested_rows)<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; )<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; or nrow &#60; (@requested_rows * @requested_page)<br />&#160;&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; )<br />&#160;&#160;&#160; ) as dub<br />order by nrow asc</p>
</div>
]]></description>
        	        	<pubDate>Sat, 25 Apr 2009 15:31:08 +0300</pubDate>
        </item>
        <item>
        	<title>foo on Bug for pager</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6300</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6300</guid>
        	        	<description><![CDATA[<p>You are correct.</p>
<p>The &#8220;PAGE&#8221; returned from the server, needs to be adjusted to:</p>
<p>total = npages<br />, page = (npages &#62;= arguments.page ? arguments.page : npages)</p>
<p>Also the query on the server needs to be adjusted, to either pick rows in the range of the page and rows requested, or the number of rows requested.</p>
<p>I&#39;ll have to think abit on how to make the rows queried for, actually line up with the pages for the requested number of rows per page, whilst keeping the query as optimal as possible.</p>
<p>Thanks for your help.</p>
]]></description>
        	        	<pubDate>Sat, 25 Apr 2009 14:27:55 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Bug for pager</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6272</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6272</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Will see what I can do, but I think that this logic should be implemented at server.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Sat, 25 Apr 2009 05:15:19 +0300</pubDate>
        </item>
        <item>
        	<title>foo on Bug for pager</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6245</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/bug-for-pager#p6245</guid>
        	        	<description><![CDATA[<p>When changing the number of rows per page, the grid does not jump back to show a page having some rows, but becomes blank as no rows fit in the page.</p>
<p>Example:</p>
<p>With records = 143.</p>
<p>nPage = 1, nPerPage = 50, shows rows 1-50 (correct)</p>
<p>nPage = 3, nPerPage = 50, shows rows 101-143 (correct)</p>
<p>nPage = 3, nPerPage = 100, shows no rows (technically correct, usably incorrect)</p>
<p>What should have happened, IMHO:</p>
<p>1. When the data fetched shows that there are no rows for the requested nPage and nPerPage</p>
<p>, AND</p>
<p>2. records shows that there are rows that can be fit into a previous page</p>
<p>, the component should requery with either:</p>
<p>A) The lowest page number that ALL the records can fit into</p>
<p>, OR</p>
<p>B) The highest (next) page that can hold at least one row</p>
</p>
<p>You&#39;re doing a stellar job with this component, btw, and I&#39;ll nag my employer for a contribution to your continous efforts, and try and contribute with a Coldfusion custom-tag.</p>
]]></description>
        	        	<pubDate>Thu, 23 Apr 2009 11:34:02 +0300</pubDate>
        </item>
</channel>
</rss>