Posted 20 February 2024, 12:26 pm EST
Hello,
Is there a way to retrieve the events linked to a sheet?
Thank you for your reply.
Forums Home / Spread / SpreadJS
Posted by: vincent.delachaux on 20 February 2024, 12:26 pm EST
Posted 20 February 2024, 12:26 pm EST
Hello,
Is there a way to retrieve the events linked to a sheet?
Thank you for your reply.
Posted 22 February 2024, 1:03 am EST
Hi,
There is no direct API to get all the events linked to a sheet or workbook. However, event binding support namespaces. You could give different namespace for the same event and then unbind the events accordingly.
Kindly refer to the following code snippet and the attached sample:
sheet.bind('ValueChanged.ns1', function () {
alert("value changed");
});
sheet.bind('ValueChanged.ns2', function () {
alert("value changed1");
});
sheet.bind('RangeChanged.ns2', function () {
alert("Range Changed");
})
document.getElementById('btn').addEventListener('click', function () {
spread.unbind('ValueChanged.ns2');
})
document.getElementById('btn2').addEventListener('click', function () {
spread.unbind('.ns2');
})
If this still doesn’t fulfill your requirement, kindly do share your use case with an example so that we could have a better understanding of your use case and could assist you accordingly.
Regards,
Ankit