PDA

View Full Version : Please help loading data/ datagrid


ericb1
11-22-2005, 05:24 PM
I'm so close! I have some actionscript to load data from an array into a datagrid, and then when the user clicks on an entry in the datagrid, to show those fields available for editing.

To get my datagrid to load correctly, I use:


datagrid.addItem(
{Date:sDate,
StartTime:sStartTime,
EndTime:sEndTime,
Activity:sActivity});


This works fine, but the text fields linked to the datagrid don't work, they just come up "undefined".

So, if I change my datagrid slightly to this:


datagrid.addItem(
anObject,
{Date:sDate,
StartTime:sStartTime,
EndTime:sEndTime,
Activity:sActivity});


Where the anObject= ({name:"Jim!!", age:30}, 25, " "); Then, the data fields work, showing the detail, but the datagrid doesn't work, it just shows 2 columns, "label" & "data".

Finally, removing the , 25, " " from the anObject definition line will make the datagrid work, but still not the fields.

Any help is greatly appreciated. I'm not sure what the , 25, " " does in that anObject definition, or what to change it to in order to get my datagrid to work properly while also displaying the fields for each entry. Thanks!

Paerez
11-22-2005, 08:26 PM
Here is an excerpt of code that I use:

var column;
column = new DataGridColumn("1");
column.headerText = "Title";
dg.addColumn(column);
column = new DataGridColumn("2");
column.headerText = "Due Date";
dg.addColumn(column);

dg.addItem({1:"Item Title", 2:"1/2/03"});