Hi, a SharedObject is definitely able to save arrays of objects. I've done something similar like you and saved an array structure with about 600 objects (plain objects, not typed) successfully to a local SharedObject, loaded it back into the client and displayed it inside a DataGrid.
If you've registered your class with Object.registerClass() and save an instance to a SharedObject this extra class info normally gets also saved within the SharedObject. What happens if you assign the result of your RemoteObject invokation directly to the DataGrid's dataProvider? Do you also need to use mx.utils.ArrayUtil.toArray() on the result? What type of collection are you passing back from the Java side? Dirk. > -----Original Message----- > From: [email protected] [mailto:[EMAIL PROTECTED] > Behalf Of Kevin Ewok > Sent: Friday, June 03, 2005 3:19 PM > To: [email protected] > Subject: [flexcoders] Re: Saving a datagrid.dataProvider to a > SharedObject > > > Matt, thanks for your response. I did what you suggested, but now my > datagrid is only populated with the last object of my dataset. When > i debugged my local SharedObject, I see that this is true (my > so.data.dataProvider only has 1 (the last) object in it). Can a > local shared object data.value truly hold an array of AS objects? > > FYI to everyone, I could only get it to display in my datagrid if i > added the 'toArray'. Either way, only the last of my 14 Pojos (which > is registered to an AS class) is getting saved to the local shared > object. > > <mx:RemoteObject source="com.MyService" > result="myLocal_so.data.dataProvider=event.result" .../> > > <mx:DataGrid id="dgSO" dataProvider="{mx.utils.ArrayUtil.toArray > (myLocal_so.data.dataProvider)}" .../> > > Any suggestions are appreciated b/c i'm stuck. Thanks. > > --- In [email protected], "Matt Chotin" <[EMAIL PROTECTED]> > wrote: > > You need to save the result of the getAllJobs call in the result > > handler, not the returned object from getAllJobs(). So in your > result > > handler of getAllJobs you can say myLocal_so.data.dataProvider = > > event.result; > > > > > > > > Matt > > > > > > > > ________________________________ > > > > From: [email protected] > [mailto:[EMAIL PROTECTED] On > > Behalf Of Kevin Ewok > > Sent: Thursday, June 02, 2005 2:23 PM > > To: [email protected] > > Subject: [flexcoders] Saving a datagrid.dataProvider to a > SharedObject > > > > > > > > flexcoders- > > I have a datagrid that is populated from an array of objects > from > > a remote method. My requirement is that if the user closes their > > browser, and opens it back up, and there IS NOT a connection, then > > to load the datagrid from the locally stored data. > > > > I am able to save text strings locally and display it in labels, > but > > that is it. I am not able to store the Pojo[] result of my > > remoteMethod or the AS dataprovider. Has anyone been able to do > > this? I was able to save an individual Pojo to a > > sharedObject.data.item, but not a collection. I guess I could loop > > through my dataProvider and create a sharedObject.data.item1, > item2, > > etc...for each dataProvider item, but I wanted to save some logic. > > > > I've tried the following and I get undefined for my value in the > SO. > > > > var myLocal_so:SharedObject; > > myLocal_so = SharedObject.getLocal("mySo"); > > > > ..//each line here represents a different failed attempt..// > > myLocal_so.data.dataProvider=myRemoteObj.getAllJobs(); > > myLocal_so.data.dataProvider=mx.utils.ArrayUtil.toArray > > (myRemoteObj.getAllJobs()); > > myLocal_so.data.dataProvider=myDatagrid.dataProvider; > > myLocal_so.data.dataProvider=myDatagrid; > > ..//... > > myLocal_so.flush(); > > > > Thanks in advance for your help. > > > > > > > > > > > > > > > > > > ________________________________ > > > > Yahoo! Groups Links > > > > * To visit your group on the web, go to: > > http://groups.yahoo.com/group/flexcoders/ > > > > * To unsubscribe from this group, send an email to: > > [EMAIL PROTECTED] > > <mailto:[EMAIL PROTECTED] > subject=Unsubscribe> > > > > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of > > Service <http://docs.yahoo.com/info/terms/> . > > > > > > > Yahoo! Groups Links > > > > > > > Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

