FlexGrid - Getting Started

Simple JS implementation

by Troy Taylor

HTML

<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.min.js"></script>
<link rel="stylesheet" href="http://cdn.wijmo.com/5.latest/styles/wijmo.min.css">
<script src="http://cdn.wijmo.com/5.latest/controls/wijmo.grid.min.js"></script>
<script src="http://cdn.wijmo.com/5.latest/interop/angular/wijmo.angular.min.js"></script>
<div ng-app="app" ng-controller="appCtrl">
  <h1>
  FlexGrid - Getting Started in AngularJS
  </h1>

  <wj-flex-grid
    items-source="data">
    </wj-flex-grid>
</div>

CSS

.wj-flexgrid {
  height: 300px;
}

JavaScript

var app = angular.module('app', ['wj']);

app.controller('appCtrl', function ($scope){
	var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
    data = [];
for (var i = 0; i < 200; i++) {
    data.push({
    id: i,
    country: countries[i % countries.length],
    active: i % 5 != 0,
    downloads: Math.round(Math.random() * 200000),
    sales: Math.random() * 100000,
    expenses: Math.random() * 50000
    });
}

$scope.data = new wijmo.collections.CollectionView(data);	
	
});