Question
Update multiple cfgrids using flash remoting
I'm working on an application to allow people to enter their
paid time off and because of the specs of the project I need to
have a cfgrid for each month, so 12 grids. I have all of the
remoting working if I hard code the grid names, but I also am able
to pass the grid name through the cfcs and display it via an alert
on the response handlers. What I cannot get to work is to create a
variable of type mx.controls.DataGrid and assign the grid name to
it. I'm assuming this is because the grid name is a string and not
a data grid object.
Does anyone know how to dynamically reference a data grids in ActionScript? I'll post the code below.
<!--- handle update response - This code does not update the grid. The value of results.gridName is 'AugPTO' --->
responseHandler.updatePTO_Result = function ( results:Object):Void {
if (results.status) {
var item:Object = results.item;
alert(results.gridName);
var grid:mx.controls.DataGrid = results.gridName;
var index:Number = _root.findItem(grid,'PTOID',results.PTOID);
grid.replaceItemAt(index,item);
}
mx.managers.CursorManager.removeBusyCursor();
alert(results.message);
}
<!--- handle update response - This code does update the grid. AugPTO is the name of the grid for August. --->
responseHandler.updatePTO_Result = function ( results:Object):Void {
if (results.status) {
var item:Object = results.item;
var index:Number = _root.findItem(AugPTO,'PTOID',results.PTOID);
AugPTO.replaceItemAt(index,item);
}
mx.managers.CursorManager.removeBusyCursor();
alert(results.message);
}
Any ideas?
Thanks,
Dan
p.s. I've followed to Real Estate example from CFDJ to get this far, so if you are familiar with that app mine is pretty similar.
Does anyone know how to dynamically reference a data grids in ActionScript? I'll post the code below.
<!--- handle update response - This code does not update the grid. The value of results.gridName is 'AugPTO' --->
responseHandler.updatePTO_Result = function ( results:Object):Void {
if (results.status) {
var item:Object = results.item;
alert(results.gridName);
var grid:mx.controls.DataGrid = results.gridName;
var index:Number = _root.findItem(grid,'PTOID',results.PTOID);
grid.replaceItemAt(index,item);
}
mx.managers.CursorManager.removeBusyCursor();
alert(results.message);
}
<!--- handle update response - This code does update the grid. AugPTO is the name of the grid for August. --->
responseHandler.updatePTO_Result = function ( results:Object):Void {
if (results.status) {
var item:Object = results.item;
var index:Number = _root.findItem(AugPTO,'PTOID',results.PTOID);
AugPTO.replaceItemAt(index,item);
}
mx.managers.CursorManager.removeBusyCursor();
alert(results.message);
}
Any ideas?
Thanks,
Dan
p.s. I've followed to Real Estate example from CFDJ to get this far, so if you are familiar with that app mine is pretty similar.