JavaScript
function getData() {
const countries = '한국,미국,일본,독일,영국,프랑스'.split(',');
const products = '노트북,모니터,키보드,마우스'.split(',');
const data = [];
for (let i = 0; i < 100; i++) {
data.push({
id: i,
country: countries[i % countries.length],
product: products[i % products.length],
sales: Math.round(Math.random() * 10000),
active: i % 2 === 0
});
}
return data;
}
const view = new wijmo.collections.CollectionView(getData());
const theGrid = new wijmo.grid.FlexGrid('#theGrid', {
autoGenerateColumns: false,
allowSorting: true,
columns: [
{ binding: 'country', header: '국가', width: '*' },
{ binding: 'product', header: '제품', width: '*' },
{ binding: 'sales', header: '매출', format: 'n0', width: '*' },
{ binding: 'active', header: '활성', width: 80 }
],
itemsSource: view
});
const filter = new wijmo.grid.filter.FlexGridFilter(theGrid);