Our state of the art Gantt chart
Hi Team,
I want to open confirmation dialogue when click on button with 'ok' , 'cancel' buttons.
On 'ok' confirmation click, I want to call APi call with parameter.
on 'cancel' confirmation dialogue click, I want to close the confirmation dialogue.
Please suggest.
Thank you,
Hi swapnakonakanchi,
What dialog are we talking about here? If you meant you want to create your own, here is docs https://bryntum.com/products/gantt/docs/api/Core/widget/MessageDialog#function-confirm
It also contains an example
new Button({
appendTo : targetElement,
text : 'confirm()',
onClick : async() => {
const result = await MessageDialog.confirm({
title : 'The big question',
message : 'Do one legged ducks swim in circles?',
okButton : 'Yes',
cancelButton : 'No'
});
Toast.show(`You answered ${result === MessageDialog.okButton ? 'Yes' : 'No'}`);
}
});
Hi Alex,
What you provided that dialogue is fine. I want to call API with parameter. On 'Yes' click. Please suggest.
Hey,
You can use the following approach to call an API with the parameter on YES click
const result = await MessageDialog.confirm({
title : 'The big question',
message : 'Do one legged ducks swim in circles?',
okButton : 'Yes',
cancelButton : 'No'
});
if(result === MessageDialog.okButton) {
// call API with parameter
}
Is that what you're looking for?
Yes, But not getting how to call API in that, I tried as below but not working. Please provide sample code.
if (result === MessageDialog.okButton) {
// call API with parameter
transport: {
url: '/Process/ModelTaskDependencies/Sync',
method: 'POST',
params: {
processModelId: null,
}
}
}