DataTable header and data update
DataTable header and data update
pberesuita
Posts: 1Questions: 0Answers: 0
Hi everyone,
I am building an Angular application and using DataTables to display some data. Right now, I am having issues being able to refresh the data in the table when I do a new query.
Here is most of the code http://live.datatables.net/oxaced/4/edit#javascript,html
This is the part where I am updating the table
var dataTable = $('#resultsTableID').dataTable({
//sDom allows us to inject various controls for the table.
sDom: 'TfC;tip',
oTableTools: {
"aButtons": ["xls"]
},
//aoColumns: columnTitles,
aoColumnDefs: scope.$eval(attrs.aoColumnDefs),
sDefaultContent: "N/A",
bRetrieve: true,
bDestroy: true,
sScrollY: "300px",
sScrollX: "100%",
sScrollXInner: "150%",
bScrollCollapse: true,
bPaginate: false
});
dataTable.fnClearTable();
dataTable.fnDraw();
dataTable.fnAddData(scope.$eval("resultsData"));
What I am suspecting is that when I do
dataTable.fnAddData(scope.$eval("resultsData"));
The aoColumnDefs of the table are still referencing the old definitions from the previous table.
Can anyone point me to the right direction? or give me some example on how to properly update DataTables?
Thank You!
I am building an Angular application and using DataTables to display some data. Right now, I am having issues being able to refresh the data in the table when I do a new query.
Here is most of the code http://live.datatables.net/oxaced/4/edit#javascript,html
This is the part where I am updating the table
var dataTable = $('#resultsTableID').dataTable({
//sDom allows us to inject various controls for the table.
sDom: 'TfC;tip',
oTableTools: {
"aButtons": ["xls"]
},
//aoColumns: columnTitles,
aoColumnDefs: scope.$eval(attrs.aoColumnDefs),
sDefaultContent: "N/A",
bRetrieve: true,
bDestroy: true,
sScrollY: "300px",
sScrollX: "100%",
sScrollXInner: "150%",
bScrollCollapse: true,
bPaginate: false
});
dataTable.fnClearTable();
dataTable.fnDraw();
dataTable.fnAddData(scope.$eval("resultsData"));
What I am suspecting is that when I do
dataTable.fnAddData(scope.$eval("resultsData"));
The aoColumnDefs of the table are still referencing the old definitions from the previous table.
Can anyone point me to the right direction? or give me some example on how to properly update DataTables?
Thank You!
This discussion has been closed.