FixedHeader shows only if window is resized or if table is sorted by clickinf on a header title
FixedHeader shows only if window is resized or if table is sorted by clickinf on a header title
m_tsatsaroni
Posts: 7Questions: 3Answers: 0
in FixedHeader
I am new to datatables and i am trying to display Fixedheader.
When the table is first loaded, the FixedHeader
is a no show. When the windows is resized or clicked on one of the tables' header to sort then it appears.
I tried so far after table draw():
columns.adjust()
fixedheader.adjust()
My test case is here:
https://www.villas-mina.com/new2/index_test_datatables.html
This question has an accepted answers - jump to answer
Answers
You have this code:
In the
update_alltab()
function. It looks like the Datatable is populated in a hiddendiv
then you display it. Move thecolumns.adjust()
andfixedHeader.adjust()
calls after thetbls_div.style.display = 'block';
statement.The problem with those calls being here:
Is that
oad_all_data()
is using an XHR request which is asynchronous. So thet.columns.adjust();
, etc runs before the XHR response and the table is loaded.Kevin
It was so simple. It is when it is actually displayed so the elements' dimensions are calculated right?
Thank you so much for your time.