You should be able to:

*       Get a reference to the dg.columns array in a var
*       Use your stored information to update the columns array var
*       RE-ASSIGN the columns var to the dg.columns property

 

Tracy

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Ian M. Jones
Sent: Thursday, May 24, 2007 10:43 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Retrieving saved DataGrid columns array from local
SharedObject.

 

Hi all,

I'm trying to set up a simple way to save a user's DataGrid column setup
to a local SharedObject, and then retrieve those settings when they next
run the application.

Saving them seems to have been pretty simple:

public function savePreferences():void {
var prefs:SharedObject = SharedObject.getLocal("Preferences");
var defaultColumns:Array = myDataGrid.columns;
prefs.data.defaultColumns = defaultColumns;
prefs.flush();
}

That works, I can see the objects in the Preferences.sol file, but I
haven't found a way of setting the grid's columns after reading it back
in.

I've tried reading back into an array and then setting the columns
property to the array.
I've tried iterating through the array with a for each casting the
results
to a DataGridColumn, appending to an ArrayCollection and then finally
setting the DataGrid's columns to the ArrayCollection.toArray, that
didn't
get very far.
I've tried binding the DataGrid's columns property to an Array, and then
setting that array to the prefs.data.defaultColumns.

Nothing seems to work, the app generally seems to hang at the point I
try
to set the columns property.

Is there a kind soul that can point me in the right direction?

Thanks,
-- 
Ian M. Jones
________________________________________
IMiJ Software
http://www.imijsoft.com <http://www.imijsoft.com> 
http://www.ianmjones.net <http://www.ianmjones.net>  (blog)

 

Reply via email to