How to reload sidebar on modal close event
AnsweredI am opening modal from sidebar. Now I want to close modal on backdrop button of modal and on clicking that backdrop button I need to reload my sidebar, but this is not working currently. On closing modal after clicking on backdrop button nothings happnes.
-
The way I would do so is by listening to an event in the sidebar app and triggering it when the modal is closed.
In your modal app:
var modalClient = ZAFClient.init();
var ticketSidebarClientPromise = modalClient.get('instances')
.then((instancesData) => {
var instances = instancesData.instances;for (var instanceGuid in instances) {
if (instances[instanceGuid].location === 'ticket_sidebar') {
return modalClient.instance(instanceGuid);
}
}
}
);
modalClient.on('modal.close', () => {
ticketSidebarClientPromise.then((ticketSidebarClient) => {
ticketSidebarClient.trigger('reload');
});
});In your ticket sidebar app:
(
var ticketSidebarClient = ZAFClient.init();
// This loads the homepage the first time
home();
ticketSidebarClient.on('reload', () => {
// This loads the homepage again when modal is closed
home();
});
)();
function home() {
// Do stuff
}I hope that helps.
-
Thanks Ahmed Zaid I had tried and was working. Thank you for your support.
Please sign in to leave a comment.
2 Comments