角度UI网格渲染,但选项不渲染

时间:2015-10-26 23:52:55

标签: javascript angularjs

我可以让网格渲染,它包含从gridOptions传递给它的数据,但是,我设置的所有自定义选项都没有在网格上生效。它似乎表现为完全默认的方式。

为了让我的自定义选项在网格上生效,我需要更改什么?

以下是显示问题的示例代码,以及显示其实际效果的Plunker:

http://plnkr.co/edit/OAguQzkn19RGvFg2FUTF?p=preview

<div ng-controller="MainCtrl">
  <div id="grid1" ui-grid="gridOptions" class="grid"></div>
</div>

<script type="text/javascript">
  var app = angular.module('app', ['ngTouch', 'ui.grid']);

  app.controller('MainCtrl', ['$scope', function ($scope) {

    $scope.gridOptions = {
      enableCellSelection: true,
      enableColumnResize: true,
      enableColumnReordering: true,
      enablePinning: true,
      enableRowReordering: true,
      enableRowSelection: true,
      enableSorting: true,

      data: [
        {
          "firstName": "Cox",
          "lastName": "Carney",
          "company": "Enormo",
          "employed": true
        },
        {
          "firstName": "Lorraine",
          "lastName": "Wise",
          "company": "Comveyer",
          "employed": false
        },
        {
          "firstName": "Nancy",
          "lastName": "Waters",
          "company": "Fuelton",
          "employed": false
        }
      ]
    };
}]);

</script>

0 个答案:

没有答案