Answered
Calling a fuction from a response Handler
I use a function with remote call to populate a grid with
data and it works fine.
function getStudentAll() {
<cfoutput> var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection( " http://#cgi.HTTP_HOST#/flashservices/gateway/");
var myService:mx.remoting.NetServiceProxy; </cfoutput> var responseHandler1
bject = {};
var approved:mx.controls.DataGrid = studentGrid;
responseHandler1.onResult = function( results: Object ):Void {
approved.dataProvider = results;
}
responseHandler1.onStatus = function( stat: Object ):Void {
alert("Error while calling cfc:" + stat.description);
}
myService = connection.getService("<cfoutput>#Application.comp#</cfoutput>.student", responseHandler1 );
myService.getStudent();
}
Pressing another button I change a value in one column and I need to reload data into the student grid. I've tried to call previous function from the response Handler in the second function but it doesn't work. I don't know why. The call doesn't even enter the getStudentAll function.
function acceptStudent() {
var studId = studentGrid.selectedItem.studId;
_root.messageStudent.text='';
<cfoutput> var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection( " http://#cgi.HTTP_HOST#/flashservices/gateway/");
var myService:mx.remoting.NetServiceProxy; </cfoutput> var responseHandler1
bject = {};
var approved:mx.controls.DataGrid = studentHistory;
responseHandler1.onResult = function( results: Number ):Void {
getStudentAll();
}
responseHandler1.onStatus = function( stat: Object ):Void {
alert("Error while calling cfc:" + stat.description);
}
myService = connection.getService("<cfoutput>#Application.comp#</cfoutput>.student", responseHandler1 );
myService.acceptStudent(studId);
}
Any idea?
Thanks,
b.
function getStudentAll() {
<cfoutput> var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection( " http://#cgi.HTTP_HOST#/flashservices/gateway/");
var myService:mx.remoting.NetServiceProxy; </cfoutput> var responseHandler1
var approved:mx.controls.DataGrid = studentGrid;
responseHandler1.onResult = function( results: Object ):Void {
approved.dataProvider = results;
}
responseHandler1.onStatus = function( stat: Object ):Void {
alert("Error while calling cfc:" + stat.description);
}
myService = connection.getService("<cfoutput>#Application.comp#</cfoutput>.student", responseHandler1 );
myService.getStudent();
}
Pressing another button I change a value in one column and I need to reload data into the student grid. I've tried to call previous function from the response Handler in the second function but it doesn't work. I don't know why. The call doesn't even enter the getStudentAll function.
function acceptStudent() {
var studId = studentGrid.selectedItem.studId;
_root.messageStudent.text='';
<cfoutput> var connection:mx.remoting.Connection = mx.remoting.NetServices.createGatewayConnection( " http://#cgi.HTTP_HOST#/flashservices/gateway/");
var myService:mx.remoting.NetServiceProxy; </cfoutput> var responseHandler1
var approved:mx.controls.DataGrid = studentHistory;
responseHandler1.onResult = function( results: Number ):Void {
getStudentAll();
}
responseHandler1.onStatus = function( stat: Object ):Void {
alert("Error while calling cfc:" + stat.description);
}
myService = connection.getService("<cfoutput>#Application.comp#</cfoutput>.student", responseHandler1 );
myService.acceptStudent(studId);
}
Any idea?
Thanks,
b.