all groups > coldfusion flash integration > june 2007 >
You're in the

coldfusion flash integration

group:

Master Detail grid with flash remoting


Master Detail grid with flash remoting kimby24
6/15/2007 12:00:00 AM
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

Re: Master Detail grid with flash remoting Chuck1411
6/16/2007 10:04:35 PM
AddThis Social Bookmark Button