2 Replies Latest reply on Feb 29, 2008 2:34 AM by robmcmi

    Watching Cairngorm ValueObjects

    robmcmi
      I have a problem using the concept of View Objects in Cairngorm.

      The problem I have is watching them. If one of my views has a custom component, like the cover flow one, I need to watch for a change to the current selectedItem. The when it changes I need to create the panels and images and add them to the cover flow component.

      Normally you would bind your data to a component like a data grid rather than watching, but with something that needs building I need to do the watching myself.

      So when I change the selected item in another view, I do something like this:

      selectedItem = issuesSpreads.getItemAt( coverflow.selectedIndex ) as SpreadVO;

      This however resets the selectedItem and anything watching it no longer picks up the changes.

      Instead, it seems I have to go through all the properties of the object and change them, triggering multiple events to be sent to my watcher (which is another problems as I have to wait for them all to be changed, although I can think of a work around, a last change var).

      This seems hacky, and also if I added a new property to the VO I would have to update all the views that change it.

      I'm wondering how people overcome this problem, I must be doing something in the wrong way here....

      Thanks

      Rob