-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Closed
Labels
Description
When refreshing datas and headers with differents datas, the tab is refreshed with new datas but sometimes and old column didn't desappear.
My usecase :
- 2 columns : "Name" and "Values".
- I refresh with 2 others columns "Age" and "Values"
- I have 3 columns "Name" (datas empty), "Age" and "Values".
- Others problemes, the column's order is not respected. I want "Values" always at the last position.
Code:
$scope.tabdatas = [{}];
$scope.gridOptions = {
enableFiltering: true,
enableSorting: true,
data : 'tabdatas',
columnDefs: []
};
function(data) {
var tab = JSON.stringify(data.tab);
$scope.tabdatas = eval('(' + tab + ')');
$scope.gridOptions.columnDefs.length = 0;
angular.forEach(Object.keys($scope.tabdatas[0]), function(key) {
if (key.toLowerCase() == "values") {
$scope.gridOptions.columnDefs.push({ field: key, enableFiltering: false, type: "number" });
} else {
$scope.gridOptions.columnDefs.push({ field: key, type: "string" });
}
}