When I open first dialog and click cancel and and then I open the second dialog and click submit I will get response
"action2"
It looks like the cancel button didn't close the dialog but only hide it and its listener is still listening on "close" event
Implementation below :
First dialog
AP.require('dialog', function (dialog) {
var newDialog = dialog.create({
key: 'somekey',
chrome: true,
});
dialog.getButton('submit').disable();
newDialog.on("close", function (result) {
console.log('action1') });
});
Second dialog
AP.require('dialog', function (dialog) {
var newDialog = dialog.create({
key: 'somekey1',
chrome: true,
});
dialog.getButton('submit').disable();
newDialog.on("close", function (result) {
console.log('action2')
});
});
In atlassian-connect.json
"generalPages":{{
"url": "/url2",
"key": "somekey",
"name": {
"value": "Dialog2"
},
"location": "none"
},{
"url": "/url1",
"key": "somekey1",
"name": {
"value": "Dialog1"
},
"location": "none"
},
}