JavaScript
var countries = ['한국', '미국', '일본', '독일'];
var products = ['Alpha', 'Beta', 'Gamma'];
var data = Array.from({ length: 24 }, function(_, i) {
return {
country: countries[i % countries.length],
product: products[Math.floor(i / countries.length) % products.length],
sales: (i + 1) * 1500 + (i % 3) * 800,
expenses: (i + 1) * 900 + (i % 2) * 400
};
});
var salesTierGroup = new wijmo.collections.PropertyGroupDescription('sales', function(item, propName) {
var sales = item[propName];
if (sales >= 25000) return '고매출 (25,000+)';
if (sales >= 15000) return '중매출 (15,000~25,000)';
return '저매출 (~15,000)';
});
var cv2 = new wijmo.collections.CollectionView(data, {
groupDescriptions: ['country', salesTierGroup]
});
cv2.sortDescriptions.push(new wijmo.collections.SortDescription('country', true));
cv2.sortDescriptions.push(new wijmo.collections.SortDescription('product', true));
var grid2 = new wijmo.grid.FlexGrid('#theGrid2', {
autoGenerateColumns: false,
columns: [
{ binding: 'country', header: '국가', visible: false },
{ binding: 'product', header: '제품', width: '*' },
{ binding: 'sales', header: '매출 (원)', format: 'n0', width: 150, aggregate: 'Sum' },
{ binding: 'expenses', header: '비용 (원)', format: 'n0', width: 150, aggregate: 'Sum' }
],
itemsSource: cv2
});