1. SmartClient Version: v9.0p_2013-08-01/Enterprise Deployment (built 2013-08-01)
2. Firefox 23.0.1
I would like to create a custom popup when the user clicks the close icon on a portlet. So far I am having trouble with this. I tried 2 different methods. Is it possible to do this and if so how?
First, by overriding the onCloseClick function but that is never actually called. When I run the code shown below a popup appears saying "ConfirmationMessage" but "OnCloseClick" is never shown. If I place a break point inside the overridden onCloseClick function it is never hit.
Also it confuses me why "ConfirmationMessage" is being shown when I've set setShowCloseConfirmationMessage to false.
Second, I tried to implement the addCloseClickHandler handler. If I did this I got 2 confirmation messages, the default and the one I set in the handler. The problem is that the portlet closes before the dialog in the clickHandler is shown. I would like it to wait until after the dialog is shown so that I can cancel the request, or stop it from going any further.
Sorry for the long post hopefully this all makes sense.
Thanks,
Chris
2. Firefox 23.0.1
I would like to create a custom popup when the user clicks the close icon on a portlet. So far I am having trouble with this. I tried 2 different methods. Is it possible to do this and if so how?
First, by overriding the onCloseClick function but that is never actually called. When I run the code shown below a popup appears saying "ConfirmationMessage" but "OnCloseClick" is never shown. If I place a break point inside the overridden onCloseClick function it is never hit.
Also it confuses me why "ConfirmationMessage" is being shown when I've set setShowCloseConfirmationMessage to false.
Code:
final Portlet viewPortlet = new Portlet() { @Override public Boolean onCloseClick() { SC.say("OnCloseClick"); return false; } }; viewPortlet.setOverflow(Overflow.HIDDEN); viewPortlet.setTitle(title); viewPortlet.addItem(child); viewPortlet.setMinWidth(100); viewPortlet.setShowCloseConfirmationMessage(false); viewPortlet.setCloseConfirmationMessage("ConfirmationMessage"); return viewPortlet;
Code:
viewPortlet.addCloseClickHandler(new CloseClickHandler() { @Override public void onCloseClick(CloseClickEvent event) { final Dialog dialog = new Dialog(); dialog.setMessage("Are you sure you want to close this???"); dialog.setIcon("[SKIN]ask.png"); dialog.setButtons(new Button("OK"), new Button("Cancel")); dialog.addButtonClickHandler(new ButtonClickHandler() { public void onButtonClick(ButtonClickEvent event) { Button clickBtn = event.getButton(); if (clickBtn.getTitle().equalsIgnoreCase("OK")) { viewPortlet.hide(); } dialog.hide(); } }); dialog.draw(); } });
Thanks,
Chris