Solved

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

Posted on 2012-04-11
9
1,146 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How To Install Bash on Windows 10

Windows’ budding partnership with Canonical has certainly led to some great improvements. One of them being the ability to use Bash on your Windows machine without third party applications! This might be one of the greatest things a cloud engineer in a Windows environment can do!

 

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
 
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
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…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

622 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