House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Mailing Lists
Home /  Groups /  ColdFusion Flash (CF-Flash)

flash remoting and refreshing a grid after database update

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
tim barth
05/20/2009 03:40 AM

I am using flash remoting to update data and refresh a grid in a flash cfform.   My goal is to have the user update data in the form (creating a call to a CFC that that performs a SQL update), then to update the data in a grid. Problem is that when I try to make the two events (update, display) happen in sequence, they seem to happen at the same time such that the data in the grid usually does not reflect the change the user just made to the database.  If I make the grid data load function independent of the update function (forcing the user to click a button), the grid refreshes fine. I'm sure I am missing something simple ... any help? Simplified examples: I have tried multiple function calls tied to the button: onclick="updatethedata('test1','test2'); refreshthegrid();" and I have tried putting that stuff in the scripts in my cfform as well: function updatethedata(param1:String, param2:String){      var responseHandler = {};      var testresult:String;      responseHandler.onResult = function( results: Object ):Void {          //when results are back, populate the grid -- the function is being called, but it pulls data before the database is updated with data          refreshthegrid();      }      responseHandler.onStatus  = function( stat: Object ):Void {          //if there is any error, show an alert          alert("Error while calling cfc:" + stat.description);      }      // do the update      myService = connection.getService("flashRemotingResponder", responseHandler );      <cfoutput>      var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection("http://#cgi.HTTP_HOST#/flashservices/gateway/");     var myService:mx.remoting.NetServiceProxy;     myService = connection.getService("flashRemotingResponder", responseHandler);    myService.updateRegistrant(param1,param2);    </cfoutput> }

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
tim barth
05/20/2009 12:23 PM

I figured this out ... put a 1/4 second sleep in each of the get data cfcs - works like a charm. Using this code before I retrieve a query in my CFC: <cfscript>       thread = CreateObject("java", "java.lang.Thread");       thread.sleep(250); </cfscript> ...that way the CFC retrieving data waits for the updating CFC to finish. ----- Excess quoted text cut - see Original Post for more -----      > var responseHandler = {};      > var testresult:String;      > responseHandler.onResult = function( results: Object ):Void {          > //when results are back, populate the grid -- the function is being > called, but it pulls data before the database is updated with data          > refreshthegrid();      > }      > responseHandler.onStatus  = function( stat: Object ):Void {          > //if there is any error, show an alert          > alert("Error while calling cfc:" + stat.description);      > } >      > // do the update      > myService = connection.getService("flashRemotingResponder", > responseHandler );      > <cfoutput>      > var connection:mx.remoting.Connection = mx.remoting.NetServices. > createGatewayConnection("http://#cgi. > HTTP_HOST#/flashservices/gateway/");      > var myService:mx.remoting.NetServiceProxy;      > myService = connection.getService("flashRemotingResponder", > responseHandler);    > myService.updateRegistrant(param1,param2);    > </cfoutput> > }

Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
Tyron Foston
05/20/2009 05:40 PM

was that the min amount of server sleep needed? did i work at say .1 seconds? Tyron E. Foston Comedy Style: Industrial Strength Http://www.TyronFoston.com http://www.myspace.com/tyronfoston --- On Wed, 5/20/09, tim barth <tim@barthhouston.com> wrote: From: tim barth <tim@barthhouston.com> Subject: Re: flash remoting and refreshing a grid after database update To: "cf-flash" <cf-flash@houseoffusion.com> Date: Wednesday, May 20, 2009, 12:17 PM I figured this out ... put a 1/4 second sleep in each of the get data cfcs - works like a charm. Using this code before I retrieve a query in my CFC: <cfscript>       thread = CreateObject("java", "java.lang.Thread");       thread.sleep(250); </cfscript> ...that way the CFC retrieving data waits for the updating CFC to finish. ----- Excess quoted text cut - see Original Post for more -----       > var responseHandler = {};       > var testresult:String;       > responseHandler.onResult = function( results: Object ):Void {           > //when results are back, populate the grid -- the function is being > called, but it pulls data before the database is updated with data           > refreshthegrid();       > }       > responseHandler.onStatus  = function( stat: Object ):Void {           > //if there is any error, show an alert           > alert("Error while calling cfc:" + stat.description);       > } >       > // do the update       > myService = connection.getService("flashRemotingResponder", > responseHandler );       > <cfoutput>       > var connection:mx.remoting.Connection = mx.remoting.NetServices. > createGatewayConnection("http://#cgi. > HTTP_HOST#/flashservices/gateway/");     > var myService:mx.remoting.NetServiceProxy;     > myService = connection.getService("flashRemotingResponder", > responseHandler);     > myService.updateRegistrant(param1,param2);     > </cfoutput> > }


<< Previous Thread Today's Threads Next Thread >>

Search cf-flash

May 18, 2013

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Designer, Developer and mobile workflow conference