there isn't any calling code, it's just a cfgrid bound to the cfc. |
Ah, sorry: I came into this late and didn't read the earlier posts.
<cfgrid> has an onerror handler for when - I presume - a bind operation fails. Does this not give you what you want? The JS function can do anything, after all.
Reading here:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-7a01.html#WSc3ff6d0ea77859461172e0811cbec22c24-72e0
That said, I dunno how to send the message back from the server, but in this case perhaps you don't: you're just trying to pass back a hard-coded string if you get an error, so why not simply hard-code the message in the <cfgrid> code?
I've never used this functionality before, so I'm pretty vague on how it works... if it sounds like it'll work, then perhaps google about a bit. Or maybe someone else here is au fait with how it all comes together..?
--
Adam
well, some people would say it's crazy to work a full day on throwing an alert, and i tend to agree. Thanks everybody for suggestions, for what it's worth, this is how it works:
do NOT specify the onLoad event in cfgrid, do NOT use ajaxonload.
instead, create this js function, with THIS particular syntax:
getTotalApps = function() {
var isGrid = ColdFusion.Grid.getGridObject('myGrid');
var isData = isGrid.getStore();
isData.addListener("load",function() {
if(isData.totalLength == 0)
{
alert("No records found");
return false;
}
});
}
ColdFusion.Event.registerOnLoad(getTotalApps,null,false,true);