JavaScript
const PRIORITY_RANK = new Map([['긴급', 0], ['보통', 1], ['낮음', 2]]);
const collator = new Intl.Collator('ko');
const tasks = [
{ id: 1, title: '결제 모듈 오류 수정', priority: '긴급', assignee: '가온', dueDate: new Date(2026, 11, 7) },
{ id: 2, title: '로그인 화면 문구 변경', priority: '낮음', assignee: '나래', dueDate: new Date(2026, 11, 20) },
{ id: 3, title: '월간 리포트 양식 개선', priority: '보통', assignee: '다온', dueDate: new Date(2026, 11, 15) },
{ id: 4, title: '서버 인증서 갱신', priority: '긴급', assignee: '나래', dueDate: new Date(2026, 11, 5) },
{ id: 5, title: '검색 결과 정렬 옵션 추가', priority: '보통', assignee: '가온', dueDate: new Date(2026, 11, 18) },
{ id: 6, title: '도움말 페이지 오타 수정', priority: '낮음', assignee: '다온', dueDate: new Date(2026, 11, 28) },
{ id: 7, title: '배포 파이프라인 점검', priority: '보통', assignee: '라온', dueDate: new Date(2026, 11, 10) },
{ id: 8, title: '고객 문의 자동 분류 개선', priority: '긴급', assignee: '라온', dueDate: new Date(2026, 11, 9) }
];
const view = new wijmo.collections.CollectionView(tasks, {
sortComparer: (a, b) => {
const rankA = PRIORITY_RANK.get(a);
const rankB = PRIORITY_RANK.get(b);
if (rankA !== undefined && rankB !== undefined) {
return Math.sign(rankA - rankB);
}
if (typeof a === 'string' && typeof b === 'string') {
return Math.sign(collator.compare(a, b));
}
return null;
}
});
view.sortDescriptions.push(new wijmo.collections.SortDescription('priority', true));
const grid = new wijmo.grid.FlexGrid('#taskGrid', {
autoGenerateColumns: false,
allowSorting: 'MultiColumn',
columns: [
{ binding: 'id', header: 'ID', width: 60 },
{ binding: 'title', header: '업무', width: '*' },
{ binding: 'priority', header: '우선순위', width: 100 },
{ binding: 'assignee', header: '담당자', width: 100 },
{ binding: 'dueDate', header: '마감일', width: 120, format: 'yyyy-MM-dd' }
],
itemsSource: view
});