Wijmo 5 - Sizing Controls
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>
<div class="container">
<h1>Sizing Wijmo 5 Controls</h1>
<p>
This is a <b>FlexGrid</b> control with five items.
The height is automatically set to fit the content
(like an HTML table):</p>
<div id="grid5" class="grid"></div>
<p></p>
<p>
This is a <b>FlexGrid</b> control with 10,000 items.
The height is limited to 300 pixels, so the grid is
scrollable:</p>
<div id="grid10k" class="grid"></div>
<p>
That's it for now...</p>
</div>
CSS
.grid {
height: auto;
max-height: 300px;
}
JavaScript
onload = function () {
// create grids
var g5 = new wijmo.grid.FlexGrid('#grid5', {
itemsSource: getData(5)
});
var g10000 = new wijmo.grid.FlexGrid('#grid10k', {
itemsSource: getData(10000)
});
// generate some random data
function getData(count) {
var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
data = [];
for (var i = 0; i < count; i++) {
data.push({
id: i,
country: countries[i % countries.length],
downloads: Math.round(Math.random() * 20000),
sales: Math.random() * 10000,
expenses: Math.random() * 5000
});
}
return data;
}
}