Solved

Is it possible to get recordcount on a cfgrid? Dynamically?

Posted on 2012-04-11
9
1,094 Views
Last Modified: 2012-04-13
I have a cfgrid on a page that is built with some default query arguments. On that page I have a form that I allow users to to enter information in and then submit. When the form is submitted I send some arguments to the cfgrid query and display the grid with the new query requirements. I am using an HTML cfgrid with bind.

Is is possible to write the recordcount of the query to the page dynamically? When a user "filters" items in the grid I'd like the recordcount to update as well.

My grid/query are all very basic but if some example code is needed please let me know.

Thank you.
0
Comment
Question by:earwig75
  • 5
  • 4
9 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 37834837
Can you post a screen shot? Because iirc, cfgrid should do that automatically.
0
 

Author Comment

by:earwig75
ID: 37834862
cfgrid only gives the pages, for example: 1 of 3 not a record count.

I found this post but it doens't seem to work... even when I use getStore instead of getDataSource.

Thanks again.
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 37834899
Some of the cfgrid/javascript stuff changed between 8/9. You're using CF9 right?
http://thecfguy.com/post.cfm/showing-record-information-in-cfgrid-footer-in-coldfusion-9

The code in that link works for me.
0
 

Author Comment

by:earwig75
ID: 37838359
Yes, I am using CF9. This seems to work but I get a script error in IE. "Object expected" on this line in the ext-all.js script "var d=n.dom.firstChild.offsetWidth;"

Do you also get this script error in IE? I looked around online and I find that everyone has this problem but I can't find a solution.
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 52

Expert Comment

by:_agx_
ID: 37838826
No, I typically use FF.  I cannot test it now, but will try it w/IE later.

everyone has this problem

Everyone meaning those using CFGRID or even people using extJS? If it's the latter, then it may be an EXT bug.
0
 

Author Comment

by:earwig75
ID: 37839215
Everyone meaning those using CFGRID or even people using extJS? If it's the latter, then it may be an EXT bug.

I found the solution you posted in a few other places and it seems like many people report having the same problem. I can't seem to find a work-around. Are there any other ways to get the record count of a grid - possibly outside of the bottom toolbar where this one puts it?

Thanks again.
0
 

Author Closing Comment

by:earwig75
ID: 37840456
This solution works but produces a javascript error in the ext .js
0
 
LVL 52

Expert Comment

by:_agx_
ID: 37841195
Finally got a chance to test with IE, and got the same error. IE is annoying sometimes... Anyway:

Are there any other ways to get the record count of a grid - possibly outside of the bottom toolbar where this one puts it?

I saw an example (somewhere?) of how to use a title bar. But it only shows the total records. Not sure how to get the current range working ie showing records x - y

               (Can't test it right now)

            <script  type="text/javascript">
                  var gridRender = function()
                  {
                             grid = ColdFusion.Grid.getGridObject('myGrid');
                             grid.store.on('load', function( ds ) {
                                 grid.setTitle('Total records: '+ grid.store.getTotalCount());
                             });
                         };  
            </script>
                ....
               <cfgrid title=""  ...rest of attributes >
                ....
0
 

Author Comment

by:earwig75
ID: 37842158
I saw an example (somewhere?) of how to use a title bar. But it only shows the total records.

This works perfectly, thank you.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now