Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to revert a change in SelectItem

    I am using SmartGWT4.1 power edition. When a user selects a specific value in SelectItem, I need to ask whether he really wants the change. If the answer is no, I need to revert to previous value. I am using ChangeEvent.cancel(), but the previous value in SelectItem is not restored.

    #2
    If you're doing something like using isc.ask() to find out if the user wants to cancel the change, that's an asynchronous approach, and it's too late to use ChangeEvent.cancel() once the user answers the dialog. Instead, you could capture the current value in the SelectItem using getValue(), and apply it via setValue() if the user chooses to revert.

    Comment


      #3
      That works if the previous value is not null.

      Initially, my SelectItem has no value, and I force the user to choose something. If the user chooses a value that can be reverted, setValue(null) will not make the selection empty.

      Comment


        #4
        Try using clearValue().

        Comment


          #5
          It works. Thanks!

          Comment

          Working...
          X