Hi Seth,
thanks for your reply - the problem is that I cannot use ICursor.find as this
only works on a sorted ArrayCollection and I cannot sort the collection in
question as it uses paging. Doing a sort fetches all items.
Also, I'm not sure what you mean by saying "If you call getItem() you'll
already have a reference to the item so just hang onto that". So far, to get a
specific item I called
var ref:ItemReference = myDataService.getItem({id: 123});
added responders to the ItemReference and waited until the result came in to
get a reference to the freshly fetched item. However, I don't want to make the
trip to server, if the object is in the client already.
What I want to achieve is the following:
1) create a new Person object
2) set the organization attribute of the Person to Organization with ID 123
4) add the new Person to the personCollection (managed by a DataService,
destination "person")
3) commit
So there are two DataService: on pointing to destination "person" and one
pointing to destination "organization"
To set the organization attribute on the Person object, I need the Organization
object with ID 123. This object may or may not already exist in the application
in another ArrayCollection so I don't want to go to the server if this
Organization object is already.
Perhaps I can use the localItems property of the DataList to look for the
Organization - if it's not there, I use getItem() to fetch it.
Dirk.
________________________________ Von: [email protected] im Auftrag von Seth Hodgson Gesendet: Fr 25.08.2006 19:54 An: [email protected] Betreff: RE: [flexcoders] FDMS: check, if an item exists on the client? Hi Dirk, getItem() will always fetch the current state of the requested object from the server and update the local instance with the result if it exists. If you don't have auto sync enabled (server pushed updates) this is how you can periodically refresh your local instance. If you call getItem() you'll already have a reference to the item so just hang onto that. If you've fill()'ed and you want to get a reference to an instance in your filled ArrayCollection take a look at the ICursor.find<X>() APIs. Best, Seth ________________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Dirk Eismann Sent: Friday, August 25, 2006 7:43 AM To: [email protected] Subject: [flexcoders] FDMS: check, if an item exists on the client? Is there any way in FDMS to get an item without really going to the server if it's on the client already? I found that calling dataService.getItem(uid) always goes to the server, even if the item in question is available on the client. This is unnecessary overhead IMHO if the item is available in the DataStore/Collection. Do I have to implement my own lookup strategy here??? Thanks, Dirk. -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 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/
<<winmail.dat>>

