Detect Table headers clicked/changed

If the user clicks to sort a Table column, reorders a column, or enables/disables a collapsed column, can this be detected so we can store it on the server as a user preference so we can put it back in the same state the left it?

Hi David,

Sorting of items in a table is done server-side, so you could provide your own container (extended from some other container) and grab the sorting properties whenever the method is called. As for the other cases, they are performed completely client-side and no events are passed to the server; so you’re out of luck there :frowning:

You will have to extend the VTable class and send events to the server when a user reorders/enables/disables columns if you need to store the states.

Sorry I can’t help more,
/Jonatan

In fact, the table component does send notifications of these to the server.

For collapsing, see Table.setColumnCollapsed(). Re-ordering of columns is harder to intercept as it happens - it is handled by the private method Table.setColumnOrder(). However, you can ask the table what is the current order with Table.getVisibleColumns().

I’ll have to correct Jonatan a bit: column reordering and visibility changes are sent to server (although always lazily), but I guess no event is ever sent of those changes inside the server side framework, so you have no way of reacting to those events.

You could perhaps query the visible columns and their order every time the user leaves the page/view/whatever, and store that information somewhere.

Edit: Henri beat me to it :slight_smile:

Live and learn, thanks guys :slight_smile:

/Jonatan