all groups > macromedia flash flash remoting > july 2004 >
You're in the

macromedia flash flash remoting

group:

Coldfusion and DataGrid Please help


Coldfusion and DataGrid Please help Pong The Greek
7/14/2004 6:20:20 AM
macromedia flash flash remoting:
My flash projector gets data from an access database through coldfusion and
puts it in an array. What I want is the following, to click on a row in the
datagrid and get back in a trace command all the data in that row.

I use the following script to fill the datagrid from the database:

NetServices.setDefaultGatewayUrl("http://127.0.0.1:8500/flashservices/gateway")
var gatewayConnection = NetServices.createGatewayConnection()
service = gatewayConnection.getService("cftemplates.optionstempl",
this)


function getAcquisitions_Result(result) {
AcqGrid.dataProvider = result;

Any help would be mostly appreciated!

Best Regards,
Re: Coldfusion and DataGrid Please help Faadiel
7/16/2004 6:25:23 PM
Its pretty staight forward actually:

Say your grid is setup as follows:

var newColumn:mx.controls.gridclasses.DataGridColumn;

newColumn = new mx.controls.gridclasses.DataGridColumn("record_id");
newColumn.headerText = "ID";
newColumn.editable = false;
newColumn.resizable = true;
newColumn.sortable = true;
newColumn.sortOnHeaderRelease = true;
newColumn.width = 25;
my_grid.addColumn(newColumn);

Setup a listener for your grid as follows:
my_grid.addEventListener("cellPress", function(evt : Object) {
evt.target._parent.my_gridcellPress(evt); } );
You wont have to do this if you add the event to the grid directly and if your
form class is something other thant mx.screens.Forms... I prefer to code my
forms in a seperate class. You have more control...

Your listener is coded as follows:

function my_gridcellPress(event){
var cell = "(" + event.columnIndex + ", " + event.itemIndex + ")";
trace("ID:" + event.target.selectedItem.record_id);
}

You should see the id field value from your grid... simple, quick and easy.

Brendan,
http://www.nsmtechnologies.com
Re: Coldfusion and DataGrid Please help Pong The Greek
7/16/2004 7:14:18 PM
Thank you!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I have stucked on something very stupid!!!
I have done everything but in the following:
event.target.selectedItem.record_id
I haven't seen that after the selectedItem goes the record_id and I got a
[Item, Item] message.

Thanks a lot!!!!
AddThis Social Bookmark Button