JavaScript
var products = [
{ name: 'FlexGrid Pro', category: '그리드', price: 450000, inStock: true },
{ name: 'FlexChart', category: '차트', price: 380000, inStock: true },
{ name: 'InputNumber', category: '입력', price: 120000, inStock: false },
{ name: 'ComboBox', category: '입력', price: 95000, inStock: true },
{ name: 'FlexPie', category: '차트', price: 210000, inStock: false },
{ name: 'MultiSelect', category: '입력', price: 145000, inStock: true },
{ name: 'TreeView', category: '내비게이션', price: 185000, inStock: true }
];
var cv = new wijmo.collections.CollectionView(products, {
sortDescriptions: [
new wijmo.collections.SortDescription('price', false)
]
});
var theGrid = new wijmo.grid.FlexGrid('#theGrid', {
autoGenerateColumns: false,
columns: [
{ binding: 'name', header: '제품명', width: '2*' },
{ binding: 'category', header: '카테고리', width: '*' },
{ binding: 'price', header: '가격(원)', width: '*', format: 'n0' },
{ binding: 'inStock', header: '재고', width: 80 }
],
itemsSource: cv
});
document.getElementById('btnFilter').addEventListener('click', function() {
cv.filter = function(item) {
return item.inStock === true;
};
});
document.getElementById('btnClearFilter').addEventListener('click', function() {
cv.filter = null;
});