0

我是 AngularJS 和 ui-grid 的新手。

我想显示水平滚动条,但它不显示并且无法更改列宽。网格的宽度不会改变,所有的列都会缩小以适应网格。

第一个。我从Horizo​​ntal_scrolling教程复制粘贴到我的 Plunker。好的。有用。

它定义列宽,如下面的代码。

$timeout( function() {
  // colCount=10;
  for (var colIndex = 0; colIndex < colCount; colIndex++) {
    $scope.gridOptions.columnDefs.push({ 
      name: 'col' + colIndex,
      width: 200
    });
  }
});

第二。我改变了一点。但它不起作用....第二个例子 Plunker

var arr = [{name:'col0', wigth: 200},
          {name:'col1', wigth: 200},
          {name:'col2', wigth: 200},
          {name:'col3', wigth: 200},
          {name:'col4', wigth: 200},
          {name:'col5', wigth: 200},
          {name:'col6', wigth: 200},
          {name:'col7', wigth: 200},
          {name:'col8', wigth: 200},
          {name:'col9', wigth: 200}];
$timeout( function() {
  // arr.length=10;
  for (var i = 0; i < arr.length; i++) {
    $scope.gridOptions.columnDefs.push(arr[i]);
  }
});

为什么第二个示例不改变列宽并且不显示水平滚动条?

1st2nd和有什么不一样?

4

1 回答 1

4

错字_

改变一切

var arr = [{name:'col0', wigth: 200},

var arr = [{name:'col0', width: 200},
于 2014-12-15T07:26:46.770 回答