change "columns" in FixedColumns dataTable
change "columns" in FixedColumns dataTable
guoqi
Posts: 5Questions: 2Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
This discussion has been closed.
Answers
Going to need a little more to go on than an empty post! Could you fill in the template text please, with a link to your test case so we can offer some help and also describe the issue.
Allan
I init a FixedColumns table,use options of “ajax” to call data,and options of "columns" to build column's title and render based on a time range selector.
Just entered the page,table is ok :
<table id="dt-table"></table>
$(function() { initTable()});
then, I change time range selector , for example,change time range from 3.1-3.7 to 4.2-4.20.now click a button ,I want to change value of options "columns", Rerequest the protocol and draw the table with 4.2-4.20:
$('#searchBt').on('click', function () {
initTable();
})
But it can't live up to that expectation.thead is disappeared,and console report an error:
It's even stranger that I click the button second time,table is right.the third time is Wrong.For the fourth time is right.So on and on
how do I change the "columns" options correctly in FixedColumns dataTable~~~~
Allan posted this:
Respecting the forum rules is the best way to get help.
The LAN has no external links...
Does it have a way to change option item to update? like setOption()、update()
Most Datatables options, including
columns
, don't have a way to change the config dynamically. Thedestroy()
API ordestroy
option is used to change the config options. This requires reinitializing the Datatable.Kevin