Discussion Area

ask questions, discuss topics, solve problems

This is a public Discussion Area  publicRSS

Thread

    • MVC in Flex
      Thread posted Sep 15 by MarkTwain80
      239 Views, 3 Comments
      Title:
      MVC in Flex
      Content:

      Hello,

      I want to implement MVC in a Flex Application. My question is regardless the framework i'm going to adopt(Cairgorm, PureMVC, etc.).

      I have a Tree in my application with some node that represent articles. When the user inserts a new article, the Tree is refreshed in order to get latest data.

      The user asked to maintin the open items in the Tree after the refresh. So, to do that, i need to save the open items before to refresh the data and restore it after the latest data come.

      My Question is:

      What is it the better place to store the temporary data?(Model or View)

      In the MVC definition, the View should render itself with data coming from the Model, but the open items aren't data related to the Model, they are specific of the View.

      Maybe my question is very simple, but please, answer me.

      Cheers,

      Mark

    Comments

    • In my opinion you should save it in the View. As you said the logic tells to save it on the View. I don't know if that is the best approach but the logic tells us it should be in the view. If you will need afterwards to use the tree opened nodes you should use the data provider of the tree not the saved data in the model.

      Anyway... you'll see what suites you better.

      • Thanks a lot for the quick answer.

        I think that as well, maybe the better thing to do is to extend the Tree class in order to provide the  functionality to save and restore the openItems.

        • That would be a good approach. Extend the Tree so it can remeber the already opened nodes. You could add a new property to the extended tree. For example rememberNodes="[true, false]" which will enable/disable your feature.