I am currently working with the Material-React-Table (which itself uses the TanStack library), which has been great at offering flexibility and customisation, however I am struggling with the "column pinning" part. I overwrite the table's state, so that I can store the preferences in local storage to persist across sessions, using the "onColumnPinningChange" callback provided. This callback provides an object in the format of
{left: [], right: ['my_pinned_column']}
However when I unpin a column it sends an empty array, which makes it impossible to know which column has been unpinned. The library provides a table API with a couple of functions which allow you to know if there are pinned columns (returns Boolean so no use to me) and another which tells me which columns are pinned (again not useful for determining which column has been 'unpinned').
It seems the only way I could work with this feature is to only allow a single column to be pinned at a time, however this is not preferable. Has anybody worked with this feature and managed to make it work in this way? Am I missing a trick/functionality provided by the library which would allow me to know which columns have been unpinned?
I have tried using the tableInstanceRef's API to get the current pinned headers, but this does not help in determining which column has been unpinned