小编New*_*ddy的帖子

angularjs UI网格 - 动态分配列和数据

我正在尝试动态添加列ui-grid并分配数据.第一次,电网工作正常.但是,当我尝试动态更改列和数据时,它无法正常工作.

$scope.myfunc = function() {

alert("Rebinding the data");
$scope.gridOptions = {};

$scope.gridOptions.columnDefs.push({
 name: 'firstName'
  });
  $scope.gridOptions.columnDefs.push({
 name: 'lastName'
  });
  $scope.gridOptions.columnDefs.push({
 name: 'company'
  });
  $scope.gridOptions.columnDefs.push({
 name: 'employed'
  });

  alert("added new columns");
  $scope.gridOptions.data = data1;

  $scope.gridApi.grid.refresh();
};
Run Code Online (Sandbox Code Playgroud)

请检查一下plunkr

任何人都可以调查这个问题并建议我如何做到这一点?

angular-ui-grid

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

angular-ui-grid ×1