开发者

List management

I have a datasource, which I show as a list in a Flex UI.

I refresh the list periodically, One of my UI requirements is to gracefully show when the datasource removes an item from the list, So I'm correlating the current list agains开发者_如何学编程t the incoming datasource.

The correlation process is this:

  1. Refresh the datasource.

  2. Loop through the existing dataset, Check each ID against the incoming items, if I can't find a match, flag the existing item as closed. (UI handles this flag on item update and does it's visual trick.)

  3. On the next refresh of data, look for flagged items in the current list and remove them.

Here's my question, am I doing this in the most efficient manner? Or is there some simple trick I'm missing?

Update: would a JAXB equivalent for as3 help here?


As I understand it, you probably want to have an custom item renderer for each item in the list. Then, when you merge the original list with the updated list, if an item has been deleted, you set a property on the list object(e.g., x[i].deleted=true). Then in your custom item renderer, you just render it differently depending on the state of the "deleted" property.

Simple.


I'm not sure I quite follow, but could you just use the new data from the data source as the data provider to the list i.e. bind it to the result of the data source update?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜