views:

118

answers:

1

Hello.

I have a TileList which represents some remote data. I also have a form which allows me to change the data. And the data may be changed by someone else too.

What is the best way to maintain data in the list in an up-to-date state? The simplest option I see is the following:

  1. Select an item in the list
  2. Edit it in the form
  3. Save it. The form submits the data to the server
  4. When the server reports success the list re-fetches it's data

The very bad thing about this workflow is that the list loses selection (a tree would also loose the nodes' expanded/collapsed state). I would really love to find out another option which would enable the list to maintain it's selection state. Any guesses on how it may be done?

A: 

My guess is to instead of doing a re-fetch of all of the list items, just send the updates to server and update the client side list (that particular node which was updated). Perhaps you achieve this by keeping that node id and calling a function to update existing list item data as soon as the update process finishes.

Wbdvlpr
That's a) painful, b) doesn't handle cases when the data is updated by other users.But that seems to be the only available option...
artemb
There might be another option. Take a look at [XMLSocket][1] and consider using it to push changes from the server to the client, or prompt the client to request an update. [1]: http://livedocs.adobe.com/flex/3/langref/index.html
John Lemberger
Thanx, but I'm looking for a solution that would help to avoid manually managing the data in the list. Like a client data store that synchronises itself with the server and acts like a data provider for the data-driven control. Very much like ExtJS's stores and proxies. I don't really need real-time.
artemb