views:

575

answers:

2

I want to save remotely (on a database) the state (visible columns, columns width and order) of a Flex3 DataGrid.

For width and visibility I can simply save them by accessing each column attribute.. ugly but possible.. But for the order? Do I have to create the dataGrid dynamically??

Any idea is appreciated thanks

A: 

Why can't you just save the order as you're looping through each column?

for(var i:int = 0; i < dataGrid.columns.size; i++)
{
    var column:DataGridColumn = dataGrid.columns[i];
    arr.push({column.visible, column.width, i});
}
CookieOfFortune
mmm.. not clear how am I saving the order there... the 'i' variable is just increased by 1, how do I know if the user has switched two columns?
luca
A: 

Aha... This is exactly what we have implemented - If you are open to a commercial alternative - Please look at http://www.flexicious.com. If not, what you could do is like the other answer, gather up all the values and persist them using a Shared Object. The order of the columns is in the index of your ArrayCollection.

Flexicoius