How to reset/refresh a widget into default status
Does anyone know how to reset or refresh a widget into default status?
Example: TabPanal Item with few TextField, user key in some value without submit, the user close that specific TabPanel Item and re-open it, it will show a plain empty widget without any value inside which is just like "reset field" function...
Thank In Advance !
All Field widgets have a reset() method which restores the widget to it's original state and clears any validation messages.
I think you can use the addBeforeCloseHandler(...) method on TabPanel to do what you want. You would need to have your widget or widget's container construct a BeforeCloseHandler and and pass it in to the TabPanel.addBeforeCloseHandler() method. Your BeforeCloseHandler would call your_widget.reset or really, you can have it do whatever you want.
We took this concept several steps further and created an abstract Tab widget that has an initialize(), destroy(), and resize() method to perform the applicable tasks. We have a special TabSelectionHandler that calls the destroy() method on the old tab and the intialize() method on the new tab.
Tags for this Thread