cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
151
Views
2
Helpful
4
Replies

containerServices.showDialog button options question

SumoPig
Level 1
Level 1

Hi,

I am trying to implement a dialog popup using the containerServices.showDialog method https://developer.cisco.com/docs/finesse/container-services/#showdialogoptions .

However, the documentation does not show the proper format of how to add buttons to the dialog. The image in the documentation shows two buttons, but the default dialog only has 'OK'.

I was able to get two buttons to show up by trying a bunch of different parameters for the options.buttons value, but would love to know the exact values that the method takes.

Thank you

1 Accepted Solution

Accepted Solutions

dhiarumu
Cisco Employee
Cisco Employee

Hi

You can try like this
var buttons = {};
buttons["OK"] = function() {console.log("OK got clicked")};
buttons["Cancel"] = function() {console.log("Cancel got clicked")};
var containerServices = finesse.containerservices.ContainerServices.init();
containerServices.showDialog({
title: 'Error Occurred',
message: 'Something went wrong',
buttons: buttons,
close: function() {
}
});

dhiarumu_0-1734365386040.png

 




View solution in original post

4 Replies 4

dhiarumu
Cisco Employee
Cisco Employee

Hi

You can try like this
var buttons = {};
buttons["OK"] = function() {console.log("OK got clicked")};
buttons["Cancel"] = function() {console.log("Cancel got clicked")};
var containerServices = finesse.containerservices.ContainerServices.init();
containerServices.showDialog({
title: 'Error Occurred',
message: 'Something went wrong',
buttons: buttons,
close: function() {
}
});

dhiarumu_0-1734365386040.png

 




Hi Dhiarumu,

Thank you for the reply, I can confirm that what you suggested works for me. I just have two follow up questions.

What would I need to add to the button functions to close the dialog? Currently, the button will execute the code, but stays open.

Is it possible to attach styling to a button using this method? For example, make one of the two buttons red?

Thanks

To close dialog, finesse.container.Container.hideDialog(); can be used.
We cannot change the styling of the buttons.

var buttons = {};
buttons["OK"] = function() {console.log("OK got clicked")};
buttons["Cancel"] = function() {console.log("Cancel got clicked");finesse.container.Container.hideDialog();};
var containerServices = finesse.containerservices.ContainerServices.init();
containerServices.showDialog({
title: 'Error Occurred',
message: 'Something went wrong',
buttons: buttons,
close: function() {
}
});

SumoPig
Level 1
Level 1

Thank you for your assistance