UI网格在同一网格上交换数据

时间:2015-01-09 13:27:24

标签: angularjs angular-ui-grid

我维护了一个网格,并且后端的每个数据都替换在同一个网格中。网格第一次正常工作无论哪个数据,但第二次css或模板有问题。以下是plunker

的链接

下面给出了从后端加载的每个数据的处理程序

    $scope.$on('dataLoaded', function (event, gridData, path, ext) {


  $activityIndicator.stopAnimating(300);
  // Setting up the path and extension for use in the service
  $scope.path = path;
  $scope.extension = ext;
  // There is a change in column for every different data set , so building the headers with the data
  var def = new Array();
  angular.forEach(Object.keys(gridData[0]), function (key) {
    def.push(
      {
        field: key, displayName: key
        //headerCellTemplate:'views/header-template.html'
      });
  });
  //Specify the columnDef: Each different data is supposed to have different columnDefs
  $scope.gridData = gridData;

  $scope.gridOptions.columnDefs = def;
});

0 个答案:

没有答案