12-13-2024 01:17 PM
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
Solved! Go to Solution.
12-16-2024 08:09 AM
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() {
}
});
12-16-2024 08:09 AM
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() {
}
});
12-16-2024 09:17 AM
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
12-16-2024 09:26 PM
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() {
}
});
12-17-2024 06:52 AM
Thank you for your assistance
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide