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.
%26lt;mx:Tile height=''100%'' width=''100%''
direction=''vertical''%26gt;
%26lt;mx:Repeater id=''rp''
dataProvider=''{model.arcMyPortfolioOptions}''%26gt;
%26lt;mx:HBox id=''hbxEditMyPortfolio'' width=''249''%26gt;
%26lt;mx:Label text=''{rp.currentItem.sectr_dsc}''
width=''150''/%26gt;
%26lt;!-- 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 --%26gt;
%26lt;mx:CheckBox id=''cbxData'' styleName=''txtWhite''
textRollOverColor=''white''
textSelectedColor=''white'' label=''{rp.currentItem.sectr_cd}''
selected=''{getCbxChecked(rp.currentItem.sectr_cd)}''/%26gt;
%26lt;/mx:HBox%26gt;
%26lt;/mx:Repeater%26gt;
%26lt;/mx:Tile%26gt;Can I redraw a page
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.Can I redraw a page
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.
Tracy
Subscribe to:
Post Comments
(Atom)
No comments:
Post a Comment