Demo - FlexGrid

by Joel Parks

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/controls/wijmo.input.min.js"></script>
<div id="gridDefault">
</div>

CSS

body {
    margin: 20px;
}

.wj-flexgrid {
    max-height: 250px;
    width: auto;
}

JavaScript

onload = function() {
    // default grid
    var gridDefault = new wijmo.grid.FlexGrid('#gridDefault', {
    	itemsSource: getData()
    });
	
	gridDefault.collectionView.sortDescriptions.push(new wijmo.collections.SortDescription('country', true));
  console.log(gridDefault.collectionView.items);

    // create some random data
    function getData() {
        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
            });
        }
        return data;
    }
}