Skip to main content
Inspiring
November 11, 2011
Question

can't get cfgrid rowcount

  • November 11, 2011
  • 1 reply
  • 1314 views

i'm trying to get the rowcount of a cfgrid on cf9, and if  0 switch a message to user.

i've tried a js attached to the onLoad of the cfgrid, keeps throwing Expected ')' and i don't see where?

function getGridData() {

var mygrid = ColdFusion.Grid.getGridObject('cApps');

var mydata = mygrid.getStore();

rowCountVal = mydata.totalLength;

alert(rowCountVal);

}

thanks for any help

This topic has been closed for replies.

1 reply

Inspiring
November 11, 2011

Comment out every line and add them back one at a time until the error occurs.  If it happens with all lines commented out, look at the code that calls it.

ionAuthor
Inspiring
November 11, 2011

thanks Dan, it's the cfgrid onload thrwoing the error. i've tried:

onload="javascript:getGridData"

onload="javascript:getGridData()"

onload="javascript:getGridData({cfgridaction}, {cfgridrow} {cfgridchanged})"

nothing works

also tried instead the <cfset ajaxOnLoad="getGridData">, it doesn't throw an error but doesn't return the rowcount either

thanks again

Inspiring
November 12, 2011

Where is your onload code in your document?  I'm assuming that if its a regular onLoad attribute of an HTML element (e.g. <Body>, then you don't need the "javascript:" prefix.  Otherwise, what happens if you pop an alert box at the top of your getGridData() method and comment out the rest - are you getting the alert box or is the error occuring before the function can even be called?