PDA

View Full Version : Alert message when navigating away GWT Roweditor without save/discard changes



swathirai
31 Oct 2011, 7:20 PM
I go into editing mode of the row. If I click anywhere in the row, I get the message that I need either to save or cancel, which is fine. But if I click any where else(eg : any other tab etc),I wont get any alert message.How to get a message asking the user to save/discard changes whenever when navigating away.Could any one please guide me.

Colin Alworth
1 Nov 2011, 5:33 PM
The RowEditor draws a tooltip if the user attempts to edit another row when the current row hasn't been saved, but that is all. You can add this behavior to other widgets by preventing user actions.

One way to do this could be to set up a way to preview dom events, and cancel them if they aren't targeted to the grid. Another way could be to cancel only certain other events, like tab selection. From those events you could display a warning or an alert, however you choose. RowEditor isn't meant to be able to prevent all user actions, just ones that would involve editing another row before finishing the first.