解决方法
您必须使用行模板.在此模板中,您可以使用ng-class并通过数据绑定动态分配CSS类.
一个简单的例子:
<body ng-controller="MyCtrl"> <div class="grid" ng-grid="gridOptions"></div> </body>
JavaScript的
var app = angular.module('myApp',['ngGrid']); app.controller('MyCtrl',function($scope) { $scope.fileOneUploaded = true; $scope.fileTwoUploaded = false; $scope.gridData = [{fileName: 'File 1',size: 1000,isuploaded: $scope.fileOneUploaded },{fileName: 'File 2',size: 2000,isuploaded: $scope.fileTwoUploaded }]; $scope.gridOptions = { data: 'gridData',rowTemplate: '<div style="height: 100%" ng-class="{red: !row.getProperty(\'isuploaded\')}">' + '<div ng-repeat="col in renderedColumns" ng-class="col.colIndex()" class="ngCell ">' + '<div ng-cell></div>' + '</div>' + '</div>' } });
CSS
.grid { width: 300px; height: 100px; border: solid 1px rgb(90,90,90); } .red { background-color: red; color: white; }
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。