There is probably a way of getting the CFC to access the page. Using
javascript and innerHTML.

I've tried it myself recently without luck. So im not sure if there are any
technical reasons that the CFC wouldn't be able to access the page via
javascript.

Someone here should know.

Regards
Dale Fraser

http://learncf.com


-----Original Message-----
From: Azadi Saryev [mailto:[EMAIL PROTECTED] 
Sent: Thursday, 4 October 2007 4:09 PM
To: CF-Talk
Subject: Re: ajaxonload() problem

Thanks for your reply, Dale!

yes, my cfgrid is bound to a cfc....  and you say it won't work then?... 
hmm... there must be a way....

if i understand you correctly:
ajax UI stuff is loaded and rendered first, and then any data is loaded 
into ajax controls;
and ajaxonload() fires inbetween the two?

it does make sense....

so is there any way i can make my showTtlrows js function rnu AFTER the 
data is loaded into my cfgrid?
can i somehow "listen" to a loadData or some similar event in the 
cfgrid? is there such an event?

or is having my cfc.function write query.recordcount to a session var 
and then outputting that on calling page the only way to return 'total 
number of matches found' data?
any other ideas?

as for wrong count: you are wrong there.  calling my js function from a 
button click returns correct totalrecords, not per grid page, but total 
underlying query.recordcount
if you look at JSON data returned by queryConvertForGrid() function, it 
includes TOTALROWCOUNT element which is query.recordcount

thanks for your help on this - really appreciate it.

Azadi


Dale Fraser wrote:
> If you grid is using a binding, it will not work.
>
> As the Ajax and grid have loaded but the call to get the data hasn't
> occurred yet. Since binded data is paged, it would return the wrong count
> anyway.
>
> If your grid is not using binding, then im not sure.
>
> Regards
> Dale Fraser
>
> http://learncf.com
>
> -----Original Message-----
> From: Azadi Saryev [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, 4 October 2007 1:29 PM
> To: CF-Talk
> Subject: ajaxonload() problem
>
> my second attempt at getting some help here...
>
> i am trying to use a <cfset ajaxonload("showTtlrows")> at the bottom of 
> my page to call a js function which gets total number of records from a 
> cfgrid (see js code below; yes, the function in itself is correct and 
> works).
> my cfgrid is bound to a cfc and works fine.  the js function is correct 
> and works, too - if i call my js function from an onclick event of a 
> button, it works just fine and returns correct number of records from my 
> cfgrid.
>
> the ajaxonload() call, however, does not work - it fires after the 
> cfgrid is drawn on the page but BEFORE it is populated with data: the 
> alert(totalrecords); pops up an alert over an empty cfgrid shell - only 
> the header and footer of the cfgrid are there, nothing else (no empty 
> rows, no data).
>
> i am far from an ajax pro, and maybe i am misunderstanding thsomething, 
> but i was under the impression that ajaxonload() fires after all ajax UI 
> elements on the page have fully loaded.... am i wrong?
> how can i make the ajaxonload() call run AFTER my cfgrid is populated 
> with data?
>
> thanks for any help!
>
> my js function:
>
> showTtlrows = function(){
>     var mygrid = ColdFusion.Grid.getGridObject('resultsGrid');
>     var mygridData = mygrid.getDataSource();
>     var ttlrecords = mygridData.getTotalCount();
>     //var ttlrecords = mygridData.totalLength;
>     alert(ttlrecords);
>     //document.getElementById('ttlrows').innerHTML = ttlrecords;
> }
>
>   

-- 

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




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion is delivering applications solutions at at top companies 
around the world in government.  Find out how and where now
http://www.adobe.com/cfusion/showcase/index.cfm?event=finder&productID=1522&loc=en_us

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:290137
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to