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%"
<mx:HBox id="hbxEditMyPortfolio" width="249">
<!-- 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"
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.