• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFGRID Dynamic PageSize

New Here ,
Oct 09, 2007 Oct 09, 2007

Copy link to clipboard

Copied

Hi All,

I am using CFGIRD with a pagesize of 25. However in some cases the recordSet returned is less than 25 records and therefore the grid will have blank space.

Does anyone know if it is possible to dynamicaly change the size of a cfgrid based on the number of records returned?
TOPICS
Advanced techniques

Views

646

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Oct 09, 2007 Oct 09, 2007
Derrick_DC wrote:
> Hi All,
>
> I am using CFGIRD with a pagesize of 25. However in some cases the recordSet
> returned is less than 25 records and therefore the grid will have blank space.
>
> Does anyone know if it is possible to dynamicaly change the size of a cfgrid
> based on the number of records returned?
>

easy. in your cfc:
1) add <cfset var ps = arguments.pagesize> after the arguments
declarations (assuming your argument that receives {cfgridpagesize}
value is named pagesize)
...

Votes

Translate

Translate
LEGEND ,
Oct 09, 2007 Oct 09, 2007

Copy link to clipboard

Copied

Derrick_DC wrote:
> Hi All,
>
> I am using CFGIRD with a pagesize of 25. However in some cases the recordSet
> returned is less than 25 records and therefore the grid will have blank space.
>
> Does anyone know if it is possible to dynamicaly change the size of a cfgrid
> based on the number of records returned?
>

easy. in your cfc:
1) add <cfset var ps = arguments.pagesize> after the arguments
declarations (assuming your argument that receives {cfgridpagesize}
value is named pagesize)
2) assuming you have a query named myQuery which pulls the data fro grid
from the db, add the following line AFTER the query: <cfif
myQuery.recordcount lt arguments.pagesize><cfset ps =
myQuery.recordcount></cfif>
3) your cfreturn line should then be: <cfreturn
queryConvertForGrid(myQuery, arguments.page, ps)

hth

--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 10, 2007 Oct 10, 2007

Copy link to clipboard

Copied

LATEST
Thanks Azadi. This worked perfectly. I read the first line of your response and immediately knew what to do. I can't believe how easy it was.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation