kipsta
11-08-2004, 10:54 AM
I'm writing a test app that monitors a system. The UI consists of a set of 'cards', each representing a live object in the system. The number of 'cards' that can be displayed changes as does the data on existing cards.
Right now, it works in that as the XML that comes back changes (i.e., the cards in the list of cards), the UI changes. What I would like is to add and remove cards as necessary and only update data on existing cards.
For example, below is the basic view I'm using:
<view name="systemCardsView" datapath="cardDataset:/cardList">
<systemCard name="myCard" datapath="card"/>
</view>
So, what I get is N number of cards displayed. In this systemCardsView view, I have a method that requests data from the system and then sets a timer to call itself again (probably a better way of doing this, but the HackMaster is flying wildly). Each time the method is called, all the cards disappear and are then replaced by a new set. This is sub-optimal as, for the most part, the cards remain the same just the data inside of them changes. Occaisionally cards and added and removed from the list.
Is there a way to update the data in the cards themselves?
- Could have the cards themselves make the data request but I want to limit the calls to the server to one large XML file as opposed to N small ones.
To only add 'new' cards?
- Instead of just re-adding everything.
To remove cards that are nolonger there?
- I know I would have to keep track of the cards processed returned and then loop over the cards present and remove the ones that aren't in my list of returned cards (probably some horrendously ineffiecient way to do that using an array).
Any thoughts on any of this would be greatly appreciated,
Thanks...
Right now, it works in that as the XML that comes back changes (i.e., the cards in the list of cards), the UI changes. What I would like is to add and remove cards as necessary and only update data on existing cards.
For example, below is the basic view I'm using:
<view name="systemCardsView" datapath="cardDataset:/cardList">
<systemCard name="myCard" datapath="card"/>
</view>
So, what I get is N number of cards displayed. In this systemCardsView view, I have a method that requests data from the system and then sets a timer to call itself again (probably a better way of doing this, but the HackMaster is flying wildly). Each time the method is called, all the cards disappear and are then replaced by a new set. This is sub-optimal as, for the most part, the cards remain the same just the data inside of them changes. Occaisionally cards and added and removed from the list.
Is there a way to update the data in the cards themselves?
- Could have the cards themselves make the data request but I want to limit the calls to the server to one large XML file as opposed to N small ones.
To only add 'new' cards?
- Instead of just re-adding everything.
To remove cards that are nolonger there?
- I know I would have to keep track of the cards processed returned and then loop over the cards present and remove the ones that aren't in my list of returned cards (probably some horrendously ineffiecient way to do that using an array).
Any thoughts on any of this would be greatly appreciated,
Thanks...