2 Replies Latest reply on Nov 1, 2007 3:05 PM by ntsiii

    Can I redraw a page

      Hi I have a list of categories in a page, each represented by a checkbox, where users can add/remove categories from their favourites. When they make selections, all the info for that user in the database is deleted and the new categories are inserted per user. When the user goes to the page at first, the checkboxes are pre-selected based on the their current preferences.
      My problem is that when a user makes new selections, and there is a problem with the save (say the database is down or something), then I want to revert back to their original options but Flex holds the new options they selected.
      Is there a way to re-draw the page or something?
      Below is my code for displaying the checkboxes.

      <mx:Tile height="100%" width="100%" direction="vertical">
      <mx:Repeater id="rp" dataProvider="{model.arcMyPortfolioOptions}">
      <mx:HBox id="hbxEditMyPortfolio" width="249">
      <mx:Label text="{rp.currentItem.sectr_dsc}" width="150"/>
      <!-- Set the label to be the sectr_cd so we can determine what the user has selected, but
      blank it out so user can't see it -->
      <mx:CheckBox id="cbxData" styleName="txtWhite" textRollOverColor="white"
      textSelectedColor="white" label="{rp.currentItem.sectr_cd}" selected="{getCbxChecked(rp.currentItem.sectr_cd)}"/>
        • 1. Re: Can I redraw a page
          Gregory Lafrance Level 6
          If you can detect the database being down, based on that you could dispatch your own event, and then reset the combo boxes as desired.
          • 2. Re: Can I redraw a page
            ntsiii Level 3
            And as soon as you get the data from the server, in the result handler, make a copy of your data. When you want to roll back, just copy the saved data to the current model.

            Be careful making the copy, that you don't just copy *references*. Assigning an object to a variable does that. if you were using xml, as I advise, you could just do xml.copy(). If you are using something else, you use a different method, depending. Maybe objectUtil.copyObject()?? I use xml, so I don't recall.