Skip to content

Problem refreshing headers with different number of columns #1645

@bakayolo

Description

@bakayolo

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 :

  1. 2 columns : "Name" and "Values".
  2. I refresh with 2 others columns "Age" and "Values"
  3. I have 3 columns "Name" (datas empty), "Age" and "Values".
  4. 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" });
}
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions