Wijimoの練習

by mahny

HTML

<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<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.grid.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.multirow.min.js"></script>
<h1>★FlexGrid</h1>
<div id="FlexGrid"></div>

JavaScript

/**
 * グリッドに当てるデータを生成する
 * @param {number} count 生成件数
 */
function createData(count) {
  
  const data = [];
  for (let i = 0; i < count; i++) {
  	const newId = i + 1;
    data.push({
      id: newId,
      country: 'hoge' + newId,
      downloads: Math.round(Math.random() * 20000),
      active: Math.floor(Math.random() * 20) % 2 == 0
    });
  }
  return data;
}

//----- メイン処理 -----
const grid = new wijmo.grid.FlexGrid('#FlexGrid');
grid.itemsSource = new wijmo.collections.CollectionView(createData(5));