|
Mailing Lists
|
Home /
Groups /
ColdFusion Flash (CF-Flash)
flash remoting and refreshing a grid after database update
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.tim barth 05/20/09 03:40 A I figured this out ... put a 1/4 second sleep in each of the get data cfcs - works like a charm.tim barth 05/20/09 12:23 P was that the min amount of server sleep needed? did i work at say .1 seconds?Tyron Foston 05/20/09 05:40 P 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> } 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> > } 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> > }
|
May 18, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||