Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to prevent jazz.ui.SwapListDialog from closing after OK button is pressed?

Hi! I'm developing a plugin for RTC WebUI and there is a SwapListDialog in it. After the user presses OK button a service is triggered that processes the data. But the dialog closes. I'd like it to remain open and update the data in it. How can I do that?

  And another less important question is how to prevent  SwapListDialog from being modal and moveable? I tried to set properties "modal:false", "moveable:false" as it extends Dialog, but no use. 

0 votes



One answer

Permanent link
Hi Serghei,

>> I'd like it to remain open and update the data in it. How can I do that?


Unfortunately, there is no built-in mechanism or API implemented to modify this behaviour in the Swap List Dialog common component.

/net.jazz.web.ui/resources/SwapListDialog.js

However, to achieve the same effect you can create a new Dojo widget that extends the Swap List Dialog and overrides it's internal behaviour. Disclaimer: This behaviour is not supported.
More specifically, in your subclass widget you need to override this internal method as follows:

_handleEventOKButtonClicked: function(event) {
   dojo.stopEvent(event);
   // this._doIt = true;
   // this.hide();
   if (this.onOK) {
      this.onOK(this);
   }
   return true;
},

The "hide" method is responsible for closing the dialog.
The "onOK" method is the callback you supplied to the Swap List Widget.

You will need to determine how to close the Swap List Dialog without using the "OK" button (e.g. Is the "Cancel" button acceptable in your scenario?). Otherwise, you will have to rely on either the "Cancel" button or the top right dialog "X" "Close" button. The following code is invoked in the latter scenario:
_handleEventDialogClosed: function() {
if (this._doIt && 
this.onOK) {
this.onOK(this);
} else if (this.onCancel) {
this.onCancel(this);
}
return true;
},
>> how to prevent  SwapListDialog from being modal and moveable?


The Swap List Dialog actually doesn't extend the Dialog common component in the Dojo sense. The name is sort of a misnomer. Rather, the Swap List Dialog widget contains an instance of the Dialog widget (e.g. this._dialog). As a result, you need to override the following method in your new Dojo widget that extends the Swap List Dialog as follows:

show: function() {
this._doIt = false;
this._dialog = new Dialog({
contentNode: this.domNode,
primaryTitle: this.dialogTitleText ? this.dialogTitleText : this.messages.msgSelectParameters,
width: this.width,
height: this.height,
onClose: dojo.hitch(this, this._handleEventDialogClosed),
modal: false, 
moveable: false
});
},
Alternatively, for both of these issues you can create your own custom widget that includes the Swap List widget (without the Dialog) and create and manage the Dialog container yourself to get the desired effect. The benefit to this approach is that you do not need to override anything and you have full control over the behaviour.
See: /net.jazz.web.ui/resources/internal/SwapList.js

HTH

Mike

1 vote

Comments

Thank you for your answer, Mike. I'll give it a try.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,927

Question asked: Aug 10 '12, 4:30 a.m.

Question was seen: 5,009 times

Last updated: Aug 24 '12, 7:41 a.m.

Confirmation Cancel Confirm