View Full Version : DataGrid - getting cell value with actionscript

11-18-2010, 08:18 PM

I have a datagrid that's data provider is an array created programmatically.
That sets two columns on the data grid.
Then I have a third column that is an estimate column - it uses a label function that checks certain criteria on the page and adds up the estimate for that row.
I can get the information from the array that stores the first two columns, but I cannot get the third column estimate info.
How can I loop through the actual datagrid rows and get the value in that column?

Any help is appreciated! Let me know if you need further explanation/example code. Thanks!

PS - I am using Flash Builder 4

11-19-2010, 03:52 AM
It sounds like a binding issue maybe? Try filling your data provider with a strongly typed model.

public class MyModel
public var col1:String;

public var col2:String;

public var col3:String;

Doing so will allow you to update the underlying data for col3, and have the value automatically update in the DataGrid cell.

11-19-2010, 04:44 PM
It's not the problem of updating the data - that works fine.

Basically, I have one page that has a datagrid that lists a bunch of items. There is an Add to Cart button for each one. When the user hits this add to cart button, the criteria for the first two columns on the cart page are added to an array. Then, on the cart page, when the cart is generated/when a checkbox is clicked/when a radio button is selected, the estimate column is generated/updated. Now, I want to send all of this data back to PHP, but the estimates are not stored in any array or in the dataprovider.

Is there a way to loop through the rows of a datagrid column and get the value?


11-27-2010, 12:27 PM
There's one thing i can't figure out, i thought i shouldn't be making a new thread just for this.
How can I add a new item at the top of a DataGrid ? Is it possible ? Like adding something to a Stack (LIFO). Thanks.

Nevermind, i found the answer, addItemAt() :)