Changing columns dynamically with angular-datatables

后端 未结 2 505
刺人心
刺人心 2021-01-28 06:29

I am using angular datatables, an angularized version of the popular jquery datatables library.

Here is my html



         


        
相关标签:
2条回答
  • 2021-01-28 06:51

    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.

    0 讨论(0)
  • 2021-01-28 06:52

    Use this

    dtColumns.push(DTColumnBuilder.newColumn('ColumnC').withTitle('ColumnC'))
    dtColumns.push(DTColumnBuilder.newColumn('ColumnD').withTitle('ColumnD'))
    
    0 讨论(0)
提交回复
热议问题