Posted 4 April 2025, 4:52 am EST
- Updated 4 April 2025, 4:57 am EST
Hi,
There is no public API in SpreadJS that can handle the closing of the filter dialog. However, it is possible to detect if the filter dialog is closed by using Mutation Observer. Please refer to the code snippet below that illustrates the same:
const filterDialog = document.querySelector('[sjs-dialog="filter"]');
console.log(filterDialog);
if (filterDialog) {
const observer = new MutationObserver((mutationsList) => {
for (let mutation of mutationsList) {
mutation.removedNodes.forEach((node) => {
if (node === filterDialog) {
observer.disconnect();
// Run your custom logic at filter dialog close here
}
});
}
});
if (filterDialog.parentNode) {
observer.observe(filterDialog.parentNode, {
childList: true,
});
}
}
You can further refer to the attached code sample that uses the above code snippet and handles the closing of the filter dialog (see below).
Additionally, could you please share your use case so that we can work on exposing the close filter dialog events?
Attachment: FilterButton: https://jscodemine.mescius.io/share/inLr7Ag0eUGXY8nirCsEPA/?defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fapp.js"]%2C"ActiveFile"%3A"%2Fapp.js"}
GIF: 
Best Regards,