1 Reply Latest reply on Jan 29, 2009 8:25 AM by Gregory Lafrance

    What is the best practice for changing view states?

    ericbelair Level 1
      I have a component with two Pie Charts that display percentages at two specific dates (think start and end values). But, I have three views: Start Value only, End Value only, or show Both. I am using a ToggleButtonBar to control the display. What is the best practice for changing this kind of view state? Right now (since this code was inherited), the view states are changed in an ActionScript function which sets the visible and includeInLayout properties on each Pie Chart based on the selectedIndex of the ToggleButtonBar, but, this just doesn't seem like the best way to do this - not very dynamic. I'd like to be able to change the state based on the name of the selectedItem, in case the order of the ToggleButtons changes, and since I am storing the name of the selectedItem for future reference.

      Would using States be better? If so, what would be the best way to implement this?

        • 1. Re: What is the best practice for changing view states?
          Gregory Lafrance Level 6
          I would stick with non-states, as I have always heard that states are more for smaller components that need to change under certain conditions, like a login screen that changes if the user needs to register.

          That said, if the UI of what you are dealing with is not overly complex, and if it will not become overly complex, maybe states is the way to go.

          Looking at your code, I don't think you'll save much in terms of lines of code.