Skip to content Skip to sidebar Skip to footer

Changing Columns Dynamically With Angular-datatables

I am using angular datatables, an angularized version of the popular jquery datatables library. Here is my html

Solution 1:

Faced the same issue in my project.

vm.table.dtInstance.DataTable.destroy();
angular.element('#table-id').children('thead').children().remove();
angular.element('#table-id').children('tbody').children().remove();
vm.table.dtColumns = columnsList;

Helped for me. It deletes whole datatable and creates it from scratch when you set new columns list.

Solution 2:

Use this

dtColumns.push(DTColumnBuilder.newColumn('ColumnC').withTitle('ColumnC'))
dtColumns.push(DTColumnBuilder.newColumn('ColumnD').withTitle('ColumnD'))

Post a Comment for "Changing Columns Dynamically With Angular-datatables"