JavaScript
// 5만 행 대용량 데이터 생성 (상태·진행률 등 그래픽 표현용 필드 포함)
function getBigData(count) {
const products = '노트북,모니터,키보드,마우스,웹캠,프린터'.split(',');
const categories = '전자,사무,가전,주변'.split(',');
const statuses = ['정상', '지연', '완료'];
const data = [];
for (let i = 0; i < count; i++) {
data.push({
id: i + 1,
product: products[i % products.length],
category: categories[i % categories.length],
status: statuses[i % statuses.length],
progress: Math.round(Math.random() * 100),
amount: Math.round(Math.random() * 1000000)
});
}
return data;
}
// 5만 행을 그대로 바인딩 — FlexGrid가 자동 가상화로 부드럽게 렌더링합니다
const bigGrid = new wijmo.grid.FlexGrid('#bigGrid', {
autoGenerateColumns: false,
columns: [
{ binding: 'id', header: 'ID', width: 70 },
{ binding: 'product', header: '제품', width: '*' },
{ binding: 'category', header: '분류', width: 90, align: 'center' },
{ binding: 'status', header: '상태', width: 110, align: 'center' },
{ binding: 'progress', header: '진행률', width: 180 },
{ binding: 'amount', header: '금액', format: 'n0', width: '*' }
],
itemsSource: getBigData(50000)
});
// itemFormatter로 셀에 배지·진행률 바·색상 코딩을 입혀 모던하게 표현합니다
const STATUS_BG = { '정상': '#e6f4ea', '지연': '#fdecea', '완료': '#e8f0fe' };
const STATUS_FG = { '정상': '#1e7e34', '지연': '#c62828', '완료': '#0056b3' };
bigGrid.itemFormatter = function (panel, r, c, cell) {
if (panel.cellType !== wijmo.grid.CellType.Cell) return;
// 셀 재활용에 대비해 커스터마이징할 스타일을 먼저 초기화
cell.style.backgroundColor = '';
cell.style.color = '';
cell.style.fontWeight = '';
const col = panel.columns[c];
const item = panel.rows[r].dataItem;
if (col.binding === 'status') {
cell.innerHTML =
'<span style="display:inline-block;padding:2px 10px;border-radius:12px;font-size:12px;' +
'font-weight:600;background:' + STATUS_BG[item.status] + ';color:' + STATUS_FG[item.status] + '">' +
item.status + '</span>';
} else if (col.binding === 'progress') {
const p = item.progress;
const barColor = p >= 70 ? '#1e7e34' : (p >= 40 ? '#f9a825' : '#c62828');
cell.innerHTML =
'<div style="display:flex;align-items:center;gap:6px">' +
'<div style="flex:1;background:#eef1f5;border-radius:6px;height:8px;overflow:hidden">' +
'<div style="background:' + barColor + ';height:8px;width:' + p + '%"></div>' +
'</div>' +
'<span style="font-size:11px;color:#666;min-width:30px">' + p + '%</span>' +
'</div>';
} else if (col.binding === 'amount') {
if (item.amount >= 700000) { cell.style.color = '#1e7e34'; cell.style.fontWeight = '700'; }
else if (item.amount < 200000) { cell.style.color = '#c62828'; }
}
};