I have multiple tables that are initialized using the same configuration (colReorder
is enabled). What I like to do is enable syncing column headers when the user reorders columns on one table.
What I did is listen to column-reorder
on the tables and then reorder programmatically the columns on the other tables. The problem comes up when the same function gets called after the programmatic reordering.
What's the best solution for this problem?
CodePudding user response:
Assuming the event handler responds synchronously...
I'd have a 'global' isBeingHandled
flag, initialised to false.
In the common event handler, if the flag is true then abort handling the event. Otherwise set it to true and continue calling the API for the other tables.
Finally, once the initial handler has finished notifying the other tables set the flag back to false.