JavaScript
// 샘플 데이터 생성
var countries = ['한국', '미국', '독일', '일본', '영국', '프랑스'];
var data = [];
for (var i = 0; i < countries.length; i++) {
data.push({
id: i + 1,
country: countries[i],
sales: Math.round(Math.random() * 10000),
expenses: Math.round(Math.random() * 5000),
active: i % 2 === 0
});
}
// FlexGrid 초기화 및 데이터 바인딩
var theGrid = new wijmo.grid.FlexGrid('#theGrid', {
autoGenerateColumns: false,
columns: [
{ binding: 'id', header: 'ID', width: 60 },
{ binding: 'country', header: '국가', width: '2*' },
{ binding: 'sales', header: '매출액', width: '*', format: 'n0' },
{ binding: 'expenses', header: '비용', width: '*', format: 'n0' },
{ binding: 'active', header: '활성', width: 80 }
],
itemsSource: data
});