How can you dynamically add/remove colums?
Closed this issue · 2 comments
sdimagno commented
In my tree-grid, the child nodes have additional columns. If any of the children are expanded, I want to have the extra columns added. I tried to update the columns on click like so:
function updateColDefs(expanded) {
var cols = expanded ? $scope.col_defs_expanded : $scope.col_defs;
$scope.columns = [];
cols.forEach(function(c) {
$scope.columns.push(c);
});
};
But this doesn't seem to change the view.
cray2015 commented
Just add a watch in the JS file like below:
scope.$watch('colDefs', function (newValue, oldValue) { if (newValue != oldValue) { scope.colDefinitions = scope.colDefs; } });
TrueDub commented
Assuming this is answered.