Is it possible to have a SC.confirm box pop up for closing a tab? I have a tab that contains a form, and I would like to be able to close that tab but ask confirmation first.
I have the following code, but it does not work.
When i click on the close icon, then SC.confirm box popped up, but the tab will be removed before i make my chose.
What can i do?
I have the following code, but it does not work.
When i click on the close icon, then SC.confirm box popped up, but the tab will be removed before i make my chose.
What can i do?
Code:
TabSet tabSet = new TabSet(); Tab tab1 = new Tab("Tab1"); tab1.setCanClose(true); Tab tab2 = new Tab("Tab2"); tab2.setCanClose(true); tabSet.addTab(tab1); tabSet.addTab(tab2); tabSet.setWidth100(); tabSet.setHeight100(); tabSet.show(); tabSet.addCloseClickHandler(new CloseClickHandler() { @Override public void onCloseClick(final TabCloseClickEvent event) { System.out.println(event.getTab().getTitle()); SC.ask("Close ?", new BooleanCallback() { @Override public void execute(Boolean value) { if(value!=null&&value) { //Yes event.cancel(); }else { //No event.cancel(); } } }); } });
Comment