Save collapse state of table refresh

Is there a way to save the state of collapsible column on table refresh?

If user collapses a column we want to maintain that state, so that it is retained on table refresh. We wanted to understand if there is any listener for column collapse which can be utilized to track the state of column collapse or expand.

http://jsfiddle.net/o3vb1cwj/

Hi @vish

I guess that we are missing a callback here. We have few methods to check amount and indexes of visible columns but we do not have any dedicated callback for this operation.

I can see that afterGetColHeader is called when we collapse and expand columns and by using the collapsibleColumns plugin you can get an updated object of collapsedSection (demo http://jsfiddle.net/handsoncode/0qoaywvs/) however this hook runs for each column and in this case it is really messy.

You can also try to check the CSS classes for collapsing indicators

addClass(divEl, 'collapsibleIndicator');
    if (this.collapsedSections[row] && this.collapsedSections[row][col] === true) {
      addClass(divEl, 'collapsed');
      fastInnerText(divEl, '+');
    } else {
      addClass(divEl, 'expanded');
      fastInnerText(divEl, '-');
    }

we are switching between two classes when user collapses/expands the block of columns.

I am marking this post as a feature request - to add callbacks dedicated for collapsing and expanding columns.