Skip to content
This repository has been archived by the owner on Dec 4, 2019. It is now read-only.

how can I add dynamic columns to datatable #277

Open
tavishiChat opened this issue Mar 16, 2017 · 1 comment
Open

how can I add dynamic columns to datatable #277

tavishiChat opened this issue Mar 16, 2017 · 1 comment

Comments

@tavishiChat
Copy link

my code goes like this:
$scope.options = {
rowHeight: 50,
headerHeight: 50,
footerHeight: 50,
scrollbarV: false,
columns: alarmTableColumns,
selectable: true,
multiSelect: true,
resizable:true,
width:1350,
cellRenderer:true,
group:false,
columnMode: 'flex'

    };

Here I am fetching the alarmTableColumns by a rest call.
Problem : when I declare this options at the end of my restcall (in a callback function) so that my alarmTableColumns are fetched, I get several errors for datatable.js for eg. TypeError: Cannot read property 'length' of undefined
at DataTableController.transposeColumnDefaults ..etc.

@ssubashchandran
Copy link

ssubashchandran commented Jun 26, 2017

May be it is too late, but for others who still look for an option, i added the dtable in the controller only after the rest call is completed and it is working fine for me.

var el = $compile('<dtable options="options" rows="dataMatrix" expanded="expanded" on-tree-toggle="treeToggled(cell)"></dtable>')($scope);
      $('#perm-matrix-table').append(el);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants