TonyGermaneri / canvas-datagrid

Canvas based data grid web component. Capable of displaying millions of contiguous hierarchical rows and columns without paging or loading, on a single canvas element.
BSD 3-Clause "New" or "Revised" License
1.43k stars 184 forks source link

Dispatch column hide/unhide events #491

Closed mdebrauw closed 2 years ago

mdebrauw commented 2 years ago

Dispatching events on hiding/unhiding columns is useful te be able to store grid state externally, (e.g. in settings or user profile).

I've now made it so that an event is dispatched for each individual column being hidden even when a group of columns is being hidden. User can handle all individual events or debounce and, on last event, retrieve grid schema to figure out which columns are hidden or not.

Also moved unhideColumns to publicMethods.js, this seemed appropriate as all the other hide/unhide methods are located there.

Similar approach could be implemented for hiding / unhiding rows, will do as separate PR if agreed on this approach for columns.

ndrsn commented 2 years ago

Very nice, thank you!