开发者

browser close event in GWT/GXT?

Hi I am using EditableGrid. i have a requirement as below, when user edits any record in grid and moves away without saving, then i need to alert the user saying that he has some data to be saved. and user should be given yes/cancel options. currently i am using 开发者_开发技巧below code, but the problem below code is executed every time when browser is closed/refreshed/logoff. but that message should be displayed when there are changes to be saved in the grid.

Window.addWindowClosingHandler(new Window.ClosingHandler() {
            @Override
            public void onWindowClosing(ClosingEvent closingEvent) {
                closingEvent.setMessage("Closing? Really?, you have unsaved data. you will loose it.");
            }
        });

Thanks, Salmon


I don't think I have understood your question correctly, but from provided code snippet, I can't see any checks, which would prevent the code of executing? So, what is the problem to check, if there are any changes in your model and only then setMessage into the event?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜