|
Mailing Lists
|
Home / Groups / ColdFusion Flash (CF-Flash)
flash remoting and refreshing a grid after database updateI 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. > 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> > } |
May 21, 2013
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||