Wijmo 5 - Customizing the grid appearance
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.grapecity.com/wijmo/5.latest/styles/wijmo.min.css">
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/interop/angular/wijmo.angular.min.js"></script>
<!-- mark this as an Angular application and give it a controller -->
<div ng-app="app" ng-controller="appCtrl" class="container">
<h3>Customizing the FlexGrid appearance</h3>
<wj-flex-grid
items-source="data"
selection-mode="Row"
is-read-only="true"
headers-visibility="Column"
initialized="initGrid(s,a)">
<wj-flex-grid-column header="Farm name" binding="name" width="*">
<span class="glyphicon glyphicon-home"></span>
<b>{{$item.name}}</b>
</wj-flex-grid-column>
<wj-flex-grid-column header="Box nr" binding="box" width="0.5*">
<i>{{$item.box}}</i>
</wj-flex-grid-column>
<wj-flex-grid-column header="Alert" binding="warning" width="0.75*">
<div style="color:#E7644E" ng-show="$item.warning != null">
<span class="glyphicon glyphicon-warning-sign"></span>
{{$item.warning}}
</div>
</wj-flex-grid-column>
</wj-flex-grid>
</div>
CSS
.wj-cell {
padding-left: 12px;
padding-top: 6px;
background-color: white;
border: none;
}
.wj-cell.wj-header {
border: 3px solid white;
background-color: #D1E1F2;
}
.wj-cell.wj-alt:not(.wj-state-selected):not(.wj-state-multi-selected) {
background-color: white;
}
.wj-cell.wj-state-selected, .wj-cell.wj-state-multi-selected {
color: black;
background-color: #f5f5ff;
}
.wj-flexgrid {
border: none;
outline: none;
}
.glyphicon-home {
color: #c0c0c0;
}
JavaScript
// define app, include Wijmo 5 directives
var app = angular.module('app', ['wj']);
// controller
app.controller('appCtrl', function ($scope) {
// create some data
var data = [
{ name: 'Farm Denver', box: 'Box 1', warning: 'Need restart' },
{ name: 'Farm Boulder', box: 'Box 2', warning: 'Need restart' },
{ name: 'Farm Aspen', box: 'Box 7' },
{ name: 'Farm Aurora', box: 'Box 7', warning: 'Check batteries' },
{ name: 'Farm Pueblo', box: 'Box 9' },
{ name: 'Farm Grand Junction', box: 'Box 12' },
{ name: 'Farm Durango', box: 'Box 32', warning: 'Call ASAP'}
];
// expose data as a CollectionView to get events
$scope.data = new wijmo.collections.CollectionView(data);
// initialize grid's default row height
$scope.initGrid = function (sender, args) {
var flex = sender;
flex.rows.defaultSize = 34;
flex.columnHeaders.rows.defaultSize = 40;
};
});