<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: changing cfgrid pageSize dynamically</title>
	<atom:link href="http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/</link>
	<description>Anuj @ ColdFusion, Flex and some more....</description>
	<lastBuildDate>Wed, 10 Mar 2010 09:31:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anuj Gakhar</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3451</link>
		<dc:creator>Anuj Gakhar</dc:creator>
		<pubDate>Mon, 09 Nov 2009 10:16:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3451</guid>
		<description>Hi Stu,
I would imagine you would have to play around with this line of code 
ds.reload({params:{start:0,limit:numRows}});

if you give a start of 5 if the pageSize is 5, that would be page 2.</description>
		<content:encoded><![CDATA[<p>Hi Stu,<br />
I would imagine you would have to play around with this line of code<br />
ds.reload({params:{start:0,limit:numRows}});</p>
<p>if you give a start of 5 if the pageSize is 5, that would be page 2.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stu</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3450</link>
		<dc:creator>stu</dc:creator>
		<pubDate>Thu, 05 Nov 2009 23:08:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3450</guid>
		<description>Also add to the above be able to page back and forward from page 2</description>
		<content:encoded><![CDATA[<p>Also add to the above be able to page back and forward from page 2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stu</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3449</link>
		<dc:creator>stu</dc:creator>
		<pubDate>Thu, 05 Nov 2009 22:36:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3449</guid>
		<description>Hi is it possible to pass the page into the grid to force it to display page 2 in certain instances</description>
		<content:encoded><![CDATA[<p>Hi is it possible to pass the page into the grid to force it to display page 2 in certain instances</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick D</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3245</link>
		<dc:creator>Nick D</dc:creator>
		<pubDate>Tue, 31 Mar 2009 21:39:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3245</guid>
		<description>If you assign x = QueryConvertForGrid(qGetArtists, page, ps) to a variable it returns a struct with a key of QUERY. Do all your normal processing until you are on the last page. Now x is a structure with 2 keys QUERY and TOALROWCOUNT. When you are on the last page loop thru X.QUERY (I assume you have a column key, in this case its ARTISTID) and check for an empty string on your column key. If it is empty do not add it to the new query MYNEWQUERY. Once you have created this new query just assign it back to X.QUERY = mynewQuery</description>
		<content:encoded><![CDATA[<p>If you assign x = QueryConvertForGrid(qGetArtists, page, ps) to a variable it returns a struct with a key of QUERY. Do all your normal processing until you are on the last page. Now x is a structure with 2 keys QUERY and TOALROWCOUNT. When you are on the last page loop thru X.QUERY (I assume you have a column key, in this case its ARTISTID) and check for an empty string on your column key. If it is empty do not add it to the new query MYNEWQUERY. Once you have created this new query just assign it back to X.QUERY = mynewQuery</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick D</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3244</link>
		<dc:creator>Nick D</dc:creator>
		<pubDate>Tue, 31 Mar 2009 21:32:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3244</guid>
		<description>cffunction name=&quot;getArtists&quot; access=&quot;remote&quot; output=&quot;false&quot; returntype=&quot;any&quot;  
    cfargument name=&quot;page&quot;  
    cfargument name=&quot;pageSize&quot;  
    cfargument name=&quot;gridsortcolumn&quot;  
    cfargument name=&quot;gridsortdirection&quot;  
	 cfset var ps = pageSize  
     cfset var qGetArtists = &quot;&quot;   

	 cfquery  name=&quot;qGetArtists&quot; datasource=&quot;#this.dsn#&quot;   
		SELECT *
		FROM Artists
		 cfif gridsortcolumn neq &quot;&quot; or gridsortdirection neq &quot;&quot;   
            order by #gridsortcolumn# #gridsortdirection#
         /cfif   
	  cfquery  
    
    
       cfset totalPages = Ceiling(qGetArtists.RecordCount/pageSize)  
      
      
     cfif page EQ totalpages  
         cfset x = QueryConvertForGrid(qGetArtists,page, ps)  
      
				 cfset myNewQuery = querynew(&quot;ADDRESS,ARTISTID,CITY,EMAIL,FAX,FIRSTNAME,LASTNAME,PHONE,POSTALCODE,STATE,THEPASSWORD &quot;)  
                 cfloop  query=&quot;x.QUERY&quot;  
                    cfif x.QUERY.ARTISTID neq &quot;&quot;  
                       cfset queryaddrow(myNewQuery)  
                       cfset querysetcell(myNewQuery,&#039;ADDRESS&#039;,x.QUERY.ADDRESS)  
                       cfset querysetcell(myNewQuery,&#039;ARTISTID&#039;,x.QUERY.ARTISTID)  
                       cfset querysetcell(myNewQuery,&#039;CITY&#039;,x.QUERY.CITY)  
                       cfset querysetcell(myNewQuery,&#039;EMAIL&#039;,x.QUERY.EMAIL)  
                       cfset querysetcell(myNewQuery,&#039;FAX&#039;,x.QUERY.FAX)  
                       cfset querysetcell(myNewQuery,&#039;FIRSTNAME&#039;,x.QUERY.FIRSTNAME)  
                       cfset querysetcell(myNewQuery,&#039;LASTNAME&#039;,x.QUERY.LASTNAME)  
                         cfset querysetcell(myNewQuery,&#039;PHONE&#039;,x.QUERY.PHONE)  
                       cfset querysetcell(myNewQuery,&#039;POSTALCODE&#039;,x.QUERY.POSTALCODE)  
                       cfset querysetcell(myNewQuery,&#039;STATE&#039;,x.QUERY.STATE)  
                       cfset querysetcell(myNewQuery,&#039;THEPASSWORD&#039;,x.QUERY.THEPASSWORD)        
                    /cfif                
                 /cfloop  
                 cfset x.QUERY =myNewQuery  
     cfelse  
	     cfset x = QueryConvertForGrid(qGetArtists, page, ps)  
	 /cfif    
 
	  cfreturn x  
  cffunction</description>
		<content:encoded><![CDATA[<p>cffunction name=&#8221;getArtists&#8221; access=&#8221;remote&#8221; output=&#8221;false&#8221; returntype=&#8221;any&#8221;<br />
    cfargument name=&#8221;page&#8221;<br />
    cfargument name=&#8221;pageSize&#8221;<br />
    cfargument name=&#8221;gridsortcolumn&#8221;<br />
    cfargument name=&#8221;gridsortdirection&#8221;<br />
	 cfset var ps = pageSize<br />
     cfset var qGetArtists = &#8220;&#8221;   </p>
<p>	 cfquery  name=&#8221;qGetArtists&#8221; datasource=&#8221;#this.dsn#&#8221;<br />
		SELECT *<br />
		FROM Artists<br />
		 cfif gridsortcolumn neq &#8220;&#8221; or gridsortdirection neq &#8220;&#8221;<br />
            order by #gridsortcolumn# #gridsortdirection#<br />
         /cfif<br />
	  cfquery  </p>
<p>       cfset totalPages = Ceiling(qGetArtists.RecordCount/pageSize)  </p>
<p>     cfif page EQ totalpages<br />
         cfset x = QueryConvertForGrid(qGetArtists,page, ps)  </p>
<p>				 cfset myNewQuery = querynew(&#8220;ADDRESS,ARTISTID,CITY,EMAIL,FAX,FIRSTNAME,LASTNAME,PHONE,POSTALCODE,STATE,THEPASSWORD &#8220;)<br />
                 cfloop  query=&#8221;x.QUERY&#8221;<br />
                    cfif x.QUERY.ARTISTID neq &#8220;&#8221;<br />
                       cfset queryaddrow(myNewQuery)<br />
                       cfset querysetcell(myNewQuery,&#8217;ADDRESS&#8217;,x.QUERY.ADDRESS)<br />
                       cfset querysetcell(myNewQuery,&#8217;ARTISTID&#8217;,x.QUERY.ARTISTID)<br />
                       cfset querysetcell(myNewQuery,&#8217;CITY&#8217;,x.QUERY.CITY)<br />
                       cfset querysetcell(myNewQuery,&#8217;EMAIL&#8217;,x.QUERY.EMAIL)<br />
                       cfset querysetcell(myNewQuery,&#8217;FAX&#8217;,x.QUERY.FAX)<br />
                       cfset querysetcell(myNewQuery,&#8217;FIRSTNAME&#8217;,x.QUERY.FIRSTNAME)<br />
                       cfset querysetcell(myNewQuery,&#8217;LASTNAME&#8217;,x.QUERY.LASTNAME)<br />
                         cfset querysetcell(myNewQuery,&#8217;PHONE&#8217;,x.QUERY.PHONE)<br />
                       cfset querysetcell(myNewQuery,&#8217;POSTALCODE&#8217;,x.QUERY.POSTALCODE)<br />
                       cfset querysetcell(myNewQuery,&#8217;STATE&#8217;,x.QUERY.STATE)<br />
                       cfset querysetcell(myNewQuery,&#8217;THEPASSWORD&#8217;,x.QUERY.THEPASSWORD)<br />
                    /cfif<br />
                 /cfloop<br />
                 cfset x.QUERY =myNewQuery<br />
     cfelse<br />
	     cfset x = QueryConvertForGrid(qGetArtists, page, ps)<br />
	 /cfif    </p>
<p>	  cfreturn x<br />
  cffunction</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick D</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3243</link>
		<dc:creator>Nick D</dc:creator>
		<pubDate>Tue, 31 Mar 2009 21:29:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3243</guid>
		<description>The solution is really simple here is the code that keeps the last records at the end.


   
   
   
   
	
    

	
		SELECT *
		FROM Artists
		 
            order by #gridsortcolumn# #gridsortdirection#
         
	
    
    
      
      
      
    
        
      
				
                
                   
                      
                      
                      
                      
                      
                      
                      
                      
                        
                      
                      
                            
                                 
                
                
    
	    
	  
 
	 
</description>
		<content:encoded><![CDATA[<p>The solution is really simple here is the code that keeps the last records at the end.</p>
<p>		SELECT *<br />
		FROM Artists</p>
<p>            order by #gridsortcolumn# #gridsortdirection#</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juan</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3204</link>
		<dc:creator>Juan</dc:creator>
		<pubDate>Thu, 05 Mar 2009 21:43:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3204</guid>
		<description>cfset calPageSize = getEmployees.RecordCount / arguments.page
    cfif calPageSize LT ps  
     cfset dif= page * (ps -    calPageSize ) 
 cfset ps = Round(ps - dif)  
cfif

Remenber the brackets!</description>
		<content:encoded><![CDATA[<p>cfset calPageSize = getEmployees.RecordCount / arguments.page<br />
    cfif calPageSize LT ps<br />
     cfset dif= page * (ps &#8211;    calPageSize )<br />
 cfset ps = Round(ps &#8211; dif)<br />
cfif</p>
<p>Remenber the brackets!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Juan</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3200</link>
		<dc:creator>Juan</dc:creator>
		<pubDate>Thu, 05 Mar 2009 21:39:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3200</guid>
		<description>
      
         
		  
	
	  


That eliminate the blanks rows at the last page.</description>
		<content:encoded><![CDATA[<p>That eliminate the blanks rows at the last page.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3091</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Fri, 09 Jan 2009 17:46:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3091</guid>
		<description>Although I still get the extra blank rows on the last page for multipage grids. Adjusting pagesize to be returned in the CFC causes errors in what data is displayed because of how pagesize is used on the return. Still would like to see a fix for this.</description>
		<content:encoded><![CDATA[<p>Although I still get the extra blank rows on the last page for multipage grids. Adjusting pagesize to be returned in the CFC causes errors in what data is displayed because of how pagesize is used on the return. Still would like to see a fix for this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/comment-page-1/#comment-3090</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Fri, 09 Jan 2009 01:23:46 +0000</pubDate>
		<guid isPermaLink="false">http://www.anujgakhar.com/2008/03/28/changing-cfgrid-pagesize-dynamically/#comment-3090</guid>
		<description>I revisited this again and now it works. The key changes I hade to make was:
1)  paging.pageSize = parseInt(numRows);
which I somehow missed previously
2) ColdFusion.Grid.refresh(strGrid, false)
Without the &#039;false&#039; value, changes in the grid could display incorrect paging results.</description>
		<content:encoded><![CDATA[<p>I revisited this again and now it works. The key changes I hade to make was:<br />
1)  paging.pageSize = parseInt(numRows);<br />
which I somehow missed previously<br />
2) ColdFusion.Grid.refresh(strGrid, false)<br />
Without the &#8216;false&#8217; value, changes in the grid could display incorrect paging results.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
