Wijmo 5 - FlexGrid Custom Sort
by Joel Parks
HTML
<script src="http://cdn.wijmo.com/5.20142.0/controls/wijmo.min.js"></script>
<link rel="stylesheet" href="http://cdn.wijmo.com/5.20142.0/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.20142.0/controls/wijmo.grid.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.min.js"></script>
<script src="http://cdn.wijmo.com/5.20142.0/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">
<h1>Auto-size columns after loading</h1>
<wj-flex-grid
items-source="data"
items-source-changed="itemsSourceChanged(s,e)">
</wj-flex-grid>
</div>
JavaScript
// define app, include Wijmo 5 directives
var app = angular.module('app', ['wj']);
// controller
app.controller('appCtrl', function ($scope) {
// create some data
$scope.data = getData();
$scope.itemsSourceChanged = function(sender, args) {
sender.autoSizeColumns();
};
});
// function used to get data for the grid
function getData() {
return [
{ name: 'Paul', age: 12, active: true },
{ name: 'Ringo', age: 10, active: true },
{ name: 'George', age: 11, active: false },
{ name: 'John', age: 14, active: false }
];
}