这是我的代码:
for (var i = 0; i < gridData.length; i++) {
var currentData = gridData
$.each(currentData, function(key, value) {
if (!angular.isFunction(value)) {
$scope.columnDefs.push({
name : key,
cellClass : 'red',
});
}
});
}
$scope.gridOptions = {
columnDefs : $scope.columnDefs
};
$scope.gridOptions.data = data;
.red{
background-color: #ff0000;
color: #ffffff;
}
<div ng-controller="GridController" id="grid1">
<div ui-grid="gridOptions" class="grid"></div>
</div>
当我从cellClass
数组中替换columnDefs
属性时,它绝对正常工作但是当我向cellClass
数组添加columnDefs
属性时,我的网格不显示数据。在检查ui-grid dom
时,我的数据与ui-grid cell
绑定,但未显示在ui上。
答案 0 :(得分:0)
简单地在ui.grid.css
中覆盖这两个css类
.ui-grid-row:nth-child(odd) .ui-grid-cell {
}
.ui-grid-row:nth-child(even) .ui-grid-cell {
}
&#13;
从ui-grid.css
中的上述css类中删除背景色css答案 1 :(得分:0)
使用cellTemplate
代替cellClass
。
示例:
cellTemplate: "<div class='red'>{{COL_FIELD}}</div>"