macromedia.coldfusion.flash_integration
[Top] [All Lists]

Master Detail grid with flash remoting

Subject: Master Detail grid with flash remoting
From: "kimby24"
Date: Fri, 15 Jun 2007 12:19:28 +0000 UTC
Newsgroups: macromedia.coldfusion.flash_integration

I've been trying to populate a detail grid based on selection from master grid  
I finally got the second grid (detail) to populate when I selected a record 
from the first grid(master), unfortunately I lost the text input fields for the 
master record that I was binding to from the Master grid. now I'm just getting 
the detail records.
 The two grids are populated by 2 different queries that reside in the same 
CFC. 

 I first populate the Master grid (userGrid) then when a row is selected I pass 
the selected rows primary key to the function that calls the detail query in 
the cfc. This query selects only the records where the Master primary key = the 
foreign key in the detail table.

 This is a sample of the code that is in the script tag that deals with the 
grid: 

 var responseHandler:Object = {};

 var userGrid:mx.controls.DataGrid = userGrid; (this is the master grid)
 var userIdGrid:mx.controls.DataGrid = userIdGrid; (this is the detail grid)

 responseHandler.onResult = function ( results: Object):Void
 {userGrid.dataProvider = results.item;
 _root.setMode('add');
 mx.managers.CursorManager.removeBusyCursor();
 }

 responseHandler.queryUserid_Result = function (results: Object):Void
 {userIdGrid.dataProvider = results.item;
 _root.setMode('add');
 mx.managers.CursorManager.removeBusyCursor();
 }

 On form load calls the getData() that populates the Mastergrid using the 
master query in the CFC - this works.
 the getData() looks like this:

 public function getData():Void
 {
 var qArgs:Object {};
 <cfoutput>
 qArgs.status = '#session.status#';
 </cfoutput>
 _global.listingService.queryAll(qArgs);
 _root.setMode('add');
 mx.managers.CursorManager.removeBusyCursor();
 }


 The master grid makes the call to populate the second grid (getUserid() in the 
onchange event, the PKNO column is the primary key:
 <cfgrid name="userGrid" ........ 
onchange="userGridChanged();getUserid(userGrid.selectedItem.PKNO)">

 The getUserid () looks like this:

 public function getUserid(pkno:String):Void
 {
 var userArgs:Object {};
 <cfoutput>
 userArgs.pkno = pkno;
 </cfoutput>
 _global.listingService.queryUserid(userArgs);
 _root.setMode('add');
 mx.managers.CursorManager.removeBusyCursor();
 }

 This function is populating the detail grid with the correct data. When I 
select a row from the master userGrid.

 The right hand panel has textinput fields for the master record that are bound 
to the master grid- userGrid. Below these textinput fields I have the detail 
grid - userIdGrid that can contain 1 or more rows. I can only get one or the 
other to populate, not both. 

 Is there a problem with the resultHandlers each specifing the .dataprovider?

 Any help would be greatly appreciated. 

 Thanks in advanced for any help,
 Kim 



<Prev in Thread] Current Thread [Next in Thread>