Change Column Count of Dynamically Generated Table
Change Column Count of Dynamically Generated Table
Hi.
I am a new user of this great product.
I need your help in a subject.
I have a table which should display statistics monthly or quarterly.
[code]
[/code]
I set tables header and body dynamically;
[code]
var headerColumn = document.createElement('td');
headerColumn.appendChild(document.createTextNode(quarterColumnHeaders[i]));
[/code]
.... etc.
When user changes his/her interval option ;
[code] $("#totalStatsTable").empty(); [/code]
i clear the table and start to fill again with DOM functions;
Each time when i set the table i want to destroy my existing datatable and set again according to chosen interval.
So if the option is monthly i want my datatables to have column headers January, February etc... If the option is Quarterly columns are; 1st Quarter etc.
Here is my function;
[code]
$("#totalStatsTable").dataTable({
bFilter: false,
bPaginate: false,
bSort: false,
bLengthChange: false,
bDestroy: true,
//bRetrieve: true,
sScrollX: "100%",
sScrollXInner: "130%",
bJQueryUI: true
});
[/code]
First load is ok but when i try to have monthly interval i have;
Uncaught TypeError: Cannot call method 'fnSetData' of undefined
and datatables header doesn't change while body of table is changed.
Thanks again for this great product and your help.
Hakan Bilgin
I am a new user of this great product.
I need your help in a subject.
I have a table which should display statistics monthly or quarterly.
[code]
[/code]
I set tables header and body dynamically;
[code]
var headerColumn = document.createElement('td');
headerColumn.appendChild(document.createTextNode(quarterColumnHeaders[i]));
[/code]
.... etc.
When user changes his/her interval option ;
[code] $("#totalStatsTable").empty(); [/code]
i clear the table and start to fill again with DOM functions;
Each time when i set the table i want to destroy my existing datatable and set again according to chosen interval.
So if the option is monthly i want my datatables to have column headers January, February etc... If the option is Quarterly columns are; 1st Quarter etc.
Here is my function;
[code]
$("#totalStatsTable").dataTable({
bFilter: false,
bPaginate: false,
bSort: false,
bLengthChange: false,
bDestroy: true,
//bRetrieve: true,
sScrollX: "100%",
sScrollXInner: "130%",
bJQueryUI: true
});
[/code]
First load is ok but when i try to have monthly interval i have;
Uncaught TypeError: Cannot call method 'fnSetData' of undefined
and datatables header doesn't change while body of table is changed.
Thanks again for this great product and your help.
Hakan Bilgin
This discussion has been closed.