Tabulator: Redrawing Table - including headers - when hidden table becomes visible

Created on 19 Jun 2017  路  3Comments  路  Source: olifolkerd/tabulator

I have 2 different tabulator instances in 2 different tabs.

At page creation time, both tabulators are built (including the one in the inactive tab).
However the once inside the hidden/background tab has headers with tabulator-header class height: 0px.

This is because - line # 1298 (of dist) we measure the innerHeight of an element in a hidden DOM tree.

There's not much to do to get the height right from the start. However, one can decide to redraw the table when the parent tab becomes active. Only issue: that does not redraw the header - if my experiments are correct.

Still working on it, but a hint would be welcome.

Question - Ask On Stack Overflow

Most helpful comment

Thanks Oli. Works perfectly. :+1:
I took the latest from master branch and added a handler for the 'onTabShow' (using primefaces as a JSF2 jar-bundler) with just a redraw - true and it's all good now.
Thanks for the responsiveness (demo tomorrow :) )
I saw the modif - was indeed trying to call verticalAlignHeaders() but that was a bit wild. I prefer if it's in master.

All 3 comments

Hey,

There were some issues with the redraw command in version 3.0, give it a go with 3.1.

You can also add the optional true to force a redraw of everything:

$("#example-table").tabulator("redraw", true);

Let me know if that helps

Cheers

Oli

On further inspection there was an issue with the redraw function.

I have just updated the 3.1 release, if you pull it down again the above code should work for you.

Thanks

Oli

Thanks Oli. Works perfectly. :+1:
I took the latest from master branch and added a handler for the 'onTabShow' (using primefaces as a JSF2 jar-bundler) with just a redraw - true and it's all good now.
Thanks for the responsiveness (demo tomorrow :) )
I saw the modif - was indeed trying to call verticalAlignHeaders() but that was a bit wild. I prefer if it's in master.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KES777 picture KES777  路  3Comments

AndrewHutcheson picture AndrewHutcheson  路  3Comments

jiaqianliCn picture jiaqianliCn  路  3Comments

tomvanlier picture tomvanlier  路  3Comments

tomheaps picture tomheaps  路  3Comments