단계나 담당자에 따라 다른 아이콘 붙이기Different icons by level or owner
작업 이름 앞에 단계에 따라(묶음·폴더·문서) 또는 담당자에 따라 다른 아이콘을 붙여요. 펼침 화살표는 그대로 두고, 정렬과 검색은 아이콘 없이 원래 이름으로 해요.Put a different icon before each task name by level or by owner. The expand arrow stays as is, and sorting and filtering still use the plain name.
코드Code
탭을 골라 코드를 복사하세요. 위 화면은 이 코드를 그대로 실행한 결과예요.Pick a tab and copy the code. The preview above runs exactly this code.
이 화면은 새 모양 옵션을 켠 모양이에요: density: 'spacious', iconStyle: 'soft', motion: true (코드에 없으면 기본 모양으로 보여요)This preview has the new-look options on: density: 'spacious', iconStyle: 'soft', motion: true (without them in your code you get the default look)
버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
<div id="app">
<div class="toolbar">
<select aria-label="아이콘 기준" id="mode">
<option value="depth" selected>단계별</option>
<option value="owner">담당자별</option>
<option value="none">붙이지 않기</option>
</select>
</div>
<div id="grid" style="height: 430px"></div>
</div>
<script type="module" src="./main.js"></script>import { createGrid } from 'maxgrid';
import { actions, options } from './example';
const api = createGrid(document.getElementById('grid'), options);
document.getElementById('mode').addEventListener('change', (event) => actions.mode(api, event.target.value));const rows = [
{
id: 'T1',
parentId: null,
task: '출시 준비',
owner: '김서연',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: '기획',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: '요구사항 정리',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: '화면 설계',
owner: '박민지',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: '개발',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: '프런트엔드',
owner: '정하은',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: '백엔드',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: '테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: '기능 테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: '성능 테스트',
owner: '임태민',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: '운영 준비',
owner: '김서연',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: '교육 자료 작성',
owner: '한지우',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row) => row.parentId === null ? 0 : depthOf(byId.get(row.parentId)) + 1;
let mode = 'depth';
// 펼침 화살표는 트리 전체가 같은 모양이에요(그림은 줄마다 못 바꿔요).
// 그래서 줄마다 다른 아이콘은 "이름 칸에 보여 줄 글자" 앞에 붙여요. 정렬·필터는 원래 이름으로 해요.
const byDepth = ['📦', '📁', '📄'];
const byOwner = { 김서연: '⭐', 이준호: '🔷', 박민지: '🟢', 최도윤: '🔶' };
const icon = (row) => mode === 'depth'
? byDepth[Math.min(depthOf(row), 2)]
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: '작업',
width: 240,
formatValue: (value, row) => mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: '담당자', width: 100 },
{ id: 'start', title: '시작', width: 110 },
{ id: 'end', title: '종료', width: 110 },
];
export const options = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
export const actions = {
mode: (api, value) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};<!doctype html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>단계나 담당자에 따라 다른 아이콘 붙이기</title>
</head>
<body>
<div class="toolbar">
<select aria-label="아이콘 기준" id="mode">
<option value="depth" selected>단계별</option>
<option value="owner">담당자별</option>
<option value="none">붙이지 않기</option>
</select>
</div>
<div id="grid" style="height: 430px"></div>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
const rows = [
{
id: 'T1',
parentId: null,
task: '출시 준비',
owner: '김서연',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: '기획',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: '요구사항 정리',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: '화면 설계',
owner: '박민지',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: '개발',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: '프런트엔드',
owner: '정하은',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: '백엔드',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: '테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: '기능 테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: '성능 테스트',
owner: '임태민',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: '운영 준비',
owner: '김서연',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: '교육 자료 작성',
owner: '한지우',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row) => row.parentId === null ? 0 : depthOf(byId.get(row.parentId)) + 1;
let mode = 'depth';
// 펼침 화살표는 트리 전체가 같은 모양이에요(그림은 줄마다 못 바꿔요).
// 그래서 줄마다 다른 아이콘은 "이름 칸에 보여 줄 글자" 앞에 붙여요. 정렬·필터는 원래 이름으로 해요.
const byDepth = ['📦', '📁', '📄'];
const byOwner = { 김서연: '⭐', 이준호: '🔷', 박민지: '🟢', 최도윤: '🔶' };
const icon = (row) => mode === 'depth'
? byDepth[Math.min(depthOf(row), 2)]
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: '작업',
width: 240,
formatValue: (value, row) => mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: '담당자', width: 100 },
{ id: 'start', title: '시작', width: 110 },
{ id: 'end', title: '종료', width: 110 },
];
const options = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
const actions = {
mode: (api, value) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};
options.ariaLabel = "단계나 담당자에 따라 다른 아이콘 붙이기";
const api = MaxGrid.createGrid(document.getElementById('grid'), options);
document.getElementById('mode').addEventListener('change', (event) => actions.mode(api, event.target.value));
</script>
</body>
</html>버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
import { Grid, useGridApi } from '@maxgrid/react';
import { actions, options, type Row } from './example';
export function ExampleGrid() {
const [api, gridRef] = useGridApi<Row>();
return (
<>
<div className="toolbar">
<select
aria-label="아이콘 기준"
disabled={!api}
onChange={(event) => api && actions.mode(api, event.target.value)}
>
<option value="depth">단계별</option>
<option value="owner">담당자별</option>
<option value="none">붙이지 않기</option>
</select>
</div>
<Grid style={{ height: 430 }} ref={gridRef} options={options} />
</>
);
}import type { GridApi, GridOptions } from '@maxgrid/react';
export interface Row {
id: string;
parentId: string | null;
task: string;
owner: string;
start: string;
end: string;
}
const rows: Row[] = [
{
id: 'T1',
parentId: null,
task: '출시 준비',
owner: '김서연',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: '기획',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: '요구사항 정리',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: '화면 설계',
owner: '박민지',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: '개발',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: '프런트엔드',
owner: '정하은',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: '백엔드',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: '테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: '기능 테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: '성능 테스트',
owner: '임태민',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: '운영 준비',
owner: '김서연',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: '교육 자료 작성',
owner: '한지우',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row: Row): number =>
row.parentId === null ? 0 : depthOf(byId.get(row.parentId) as Row) + 1;
type Mode = 'depth' | 'owner' | 'none';
let mode: Mode = 'depth';
// 펼침 화살표는 트리 전체가 같은 모양이에요(그림은 줄마다 못 바꿔요).
// 그래서 줄마다 다른 아이콘은 "이름 칸에 보여 줄 글자" 앞에 붙여요. 정렬·필터는 원래 이름으로 해요.
const byDepth = ['📦', '📁', '📄'];
const byOwner: Record<string, string> = { 김서연: '⭐', 이준호: '🔷', 박민지: '🟢', 최도윤: '🔶' };
const icon = (row: Row): string =>
mode === 'depth'
? (byDepth[Math.min(depthOf(row), 2)] as string)
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: '작업',
width: 240,
formatValue: (value: unknown, row: Row) =>
mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: '담당자', width: 100 },
{ id: 'start', title: '시작', width: 110 },
{ id: 'end', title: '종료', width: 110 },
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
export const actions = {
mode: (api: GridApi<Row>, value?: string) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
<script setup lang="ts">
import { shallowRef } from 'vue';
import { Grid, type GridApi } from '@maxgrid/vue';
import { actions, options, type Row } from './example';
const api = shallowRef<GridApi<Row> | null>(null);
function onReady(event: { api: GridApi<Row> }) {
api.value = event.api;
}
</script>
<template>
<div class="toolbar">
<select
aria-label="아이콘 기준"
:disabled="!api"
@change="api && actions.mode(api, ($event.target as HTMLSelectElement).value)"
>
<option value="depth" selected>단계별</option>
<option value="owner">담당자별</option>
<option value="none">붙이지 않기</option>
</select>
</div>
<Grid style="height: 430px" :options="options" @ready="onReady" />
</template>import type { GridApi, GridOptions } from '@maxgrid/vue';
export interface Row {
id: string;
parentId: string | null;
task: string;
owner: string;
start: string;
end: string;
}
const rows: Row[] = [
{
id: 'T1',
parentId: null,
task: '출시 준비',
owner: '김서연',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: '기획',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: '요구사항 정리',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: '화면 설계',
owner: '박민지',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: '개발',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: '프런트엔드',
owner: '정하은',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: '백엔드',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: '테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: '기능 테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: '성능 테스트',
owner: '임태민',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: '운영 준비',
owner: '김서연',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: '교육 자료 작성',
owner: '한지우',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row: Row): number =>
row.parentId === null ? 0 : depthOf(byId.get(row.parentId) as Row) + 1;
type Mode = 'depth' | 'owner' | 'none';
let mode: Mode = 'depth';
// 펼침 화살표는 트리 전체가 같은 모양이에요(그림은 줄마다 못 바꿔요).
// 그래서 줄마다 다른 아이콘은 "이름 칸에 보여 줄 글자" 앞에 붙여요. 정렬·필터는 원래 이름으로 해요.
const byDepth = ['📦', '📁', '📄'];
const byOwner: Record<string, string> = { 김서연: '⭐', 이준호: '🔷', 박민지: '🟢', 최도윤: '🔶' };
const icon = (row: Row): string =>
mode === 'depth'
? (byDepth[Math.min(depthOf(row), 2)] as string)
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: '작업',
width: 240,
formatValue: (value: unknown, row: Row) =>
mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: '담당자', width: 100 },
{ id: 'start', title: '시작', width: 110 },
{ id: 'end', title: '종료', width: 110 },
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
export const actions = {
mode: (api: GridApi<Row>, value?: string) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};버튼을 누르면 이 예제의 코드가 StackBlitz나 CodeSandbox로 전송돼요. 누르기 전에는 아무것도 보내지 않아요.
import { Component } from '@angular/core';
import { GridComponent, isGridEvent, type GridApi, type GridEventMessage } from '@maxgrid/angular';
import { actions, options, type Row } from './example';
@Component({
selector: 'app-example-grid',
standalone: true,
imports: [GridComponent],
template: `
<div class="toolbar">
<select
aria-label="아이콘 기준"
[disabled]="!api"
(change)="api && actions.mode(api, $any($event.target).value)"
>
<option value="depth" selected>단계별</option>
<option value="owner">담당자별</option>
<option value="none">붙이지 않기</option>
</select>
</div>
<mx-grid style="height: 430px" [options]="options" [events]="relayed" (gridEvent)="onEvent($event)" />
`,
})
export class ExampleGridComponent {
readonly options = options;
readonly actions = actions;
readonly relayed = ['ready'] as const;
api: GridApi<Row> | null = null;
onEvent(event: GridEventMessage<Row>): void {
if (isGridEvent(event, 'ready')) {
this.api = event.payload.api;
}
}
}import type { GridApi, GridOptions } from '@maxgrid/angular';
export interface Row {
id: string;
parentId: string | null;
task: string;
owner: string;
start: string;
end: string;
}
const rows: Row[] = [
{
id: 'T1',
parentId: null,
task: '출시 준비',
owner: '김서연',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: '기획',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: '요구사항 정리',
owner: '이준호',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: '화면 설계',
owner: '박민지',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: '개발',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: '프런트엔드',
owner: '정하은',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: '백엔드',
owner: '최도윤',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: '테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: '기능 테스트',
owner: '박민지',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: '성능 테스트',
owner: '임태민',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: '운영 준비',
owner: '김서연',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: '교육 자료 작성',
owner: '한지우',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row: Row): number =>
row.parentId === null ? 0 : depthOf(byId.get(row.parentId) as Row) + 1;
type Mode = 'depth' | 'owner' | 'none';
let mode: Mode = 'depth';
// 펼침 화살표는 트리 전체가 같은 모양이에요(그림은 줄마다 못 바꿔요).
// 그래서 줄마다 다른 아이콘은 "이름 칸에 보여 줄 글자" 앞에 붙여요. 정렬·필터는 원래 이름으로 해요.
const byDepth = ['📦', '📁', '📄'];
const byOwner: Record<string, string> = { 김서연: '⭐', 이준호: '🔷', 박민지: '🟢', 최도윤: '🔶' };
const icon = (row: Row): string =>
mode === 'depth'
? (byDepth[Math.min(depthOf(row), 2)] as string)
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: '작업',
width: 240,
formatValue: (value: unknown, row: Row) =>
mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: '담당자', width: 100 },
{ id: 'start', title: '시작', width: 110 },
{ id: 'end', title: '종료', width: 110 },
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
export const actions = {
mode: (api: GridApi<Row>, value?: string) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
<div id="app">
<div class="toolbar">
<select aria-label="Icons by" id="mode">
<option value="depth" selected>By level</option>
<option value="owner">By owner</option>
<option value="none">None</option>
</select>
</div>
<div id="grid" style="height: 430px"></div>
</div>
<script type="module" src="./main.js"></script>import { createGrid } from 'maxgrid';
import { actions, options } from './example';
const api = createGrid(document.getElementById('grid'), options);
document.getElementById('mode').addEventListener('change', (event) => actions.mode(api, event.target.value));const rows = [
{
id: 'T1',
parentId: null,
task: 'Release',
owner: 'Emma Stone',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: 'Planning',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: 'Gather requirements',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: 'Screen design',
owner: 'Mia Parker',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: 'Development',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: 'Frontend',
owner: 'Ava Moore',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: 'Backend',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: 'Testing',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: 'Functional test',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: 'Performance test',
owner: 'Ethan Lee',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: 'Operations prep',
owner: 'Emma Stone',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: 'Write training materials',
owner: 'Grace Hall',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row) => row.parentId === null ? 0 : depthOf(byId.get(row.parentId)) + 1;
let mode = 'depth';
// The expand arrow looks the same across the whole tree (the picture cannot differ per row).
// So a per-row icon goes in front of the text shown in the name cell. Sorting and filtering use the original name.
const byDepth = ['📦', '📁', '📄'];
const byOwner = {
'Emma Stone': '⭐',
'Liam Carter': '🔷',
'Mia Parker': '🟢',
'Noah Davis': '🔶',
};
const icon = (row) => mode === 'depth'
? byDepth[Math.min(depthOf(row), 2)]
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: 'Task',
width: 240,
formatValue: (value, row) => mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: 'Owner', width: 120 },
{ id: 'start', title: 'Start', width: 110 },
{ id: 'end', title: 'End', width: 110 },
];
export const options = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
export const actions = {
mode: (api, value) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Different icons by level or owner</title>
</head>
<body>
<div class="toolbar">
<select aria-label="Icons by" id="mode">
<option value="depth" selected>By level</option>
<option value="owner">By owner</option>
<option value="none">None</option>
</select>
</div>
<div id="grid" style="height: 430px"></div>
<script src="https://cdn.maxmine.com/maxgrid/latest/maxgrid.min.js"></script>
<script>
const rows = [
{
id: 'T1',
parentId: null,
task: 'Release',
owner: 'Emma Stone',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: 'Planning',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: 'Gather requirements',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: 'Screen design',
owner: 'Mia Parker',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: 'Development',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: 'Frontend',
owner: 'Ava Moore',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: 'Backend',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: 'Testing',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: 'Functional test',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: 'Performance test',
owner: 'Ethan Lee',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: 'Operations prep',
owner: 'Emma Stone',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: 'Write training materials',
owner: 'Grace Hall',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row) => row.parentId === null ? 0 : depthOf(byId.get(row.parentId)) + 1;
let mode = 'depth';
// The expand arrow looks the same across the whole tree (the picture cannot differ per row).
// So a per-row icon goes in front of the text shown in the name cell. Sorting and filtering use the original name.
const byDepth = ['📦', '📁', '📄'];
const byOwner = {
'Emma Stone': '⭐',
'Liam Carter': '🔷',
'Mia Parker': '🟢',
'Noah Davis': '🔶',
};
const icon = (row) => mode === 'depth'
? byDepth[Math.min(depthOf(row), 2)]
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: 'Task',
width: 240,
formatValue: (value, row) => mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: 'Owner', width: 120 },
{ id: 'start', title: 'Start', width: 110 },
{ id: 'end', title: 'End', width: 110 },
];
const options = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
const actions = {
mode: (api, value) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};
options.ariaLabel = "Different icons by level or owner";
const api = MaxGrid.createGrid(document.getElementById('grid'), options);
document.getElementById('mode').addEventListener('change', (event) => actions.mode(api, event.target.value));
</script>
</body>
</html>When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
import { Grid, useGridApi } from '@maxgrid/react';
import { actions, options, type Row } from './example';
export function ExampleGrid() {
const [api, gridRef] = useGridApi<Row>();
return (
<>
<div className="toolbar">
<select
aria-label="Icons by"
disabled={!api}
onChange={(event) => api && actions.mode(api, event.target.value)}
>
<option value="depth">By level</option>
<option value="owner">By owner</option>
<option value="none">None</option>
</select>
</div>
<Grid style={{ height: 430 }} ref={gridRef} options={options} />
</>
);
}import type { GridApi, GridOptions } from '@maxgrid/react';
export interface Row {
id: string;
parentId: string | null;
task: string;
owner: string;
start: string;
end: string;
}
const rows: Row[] = [
{
id: 'T1',
parentId: null,
task: 'Release',
owner: 'Emma Stone',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: 'Planning',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: 'Gather requirements',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: 'Screen design',
owner: 'Mia Parker',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: 'Development',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: 'Frontend',
owner: 'Ava Moore',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: 'Backend',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: 'Testing',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: 'Functional test',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: 'Performance test',
owner: 'Ethan Lee',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: 'Operations prep',
owner: 'Emma Stone',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: 'Write training materials',
owner: 'Grace Hall',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row: Row): number =>
row.parentId === null ? 0 : depthOf(byId.get(row.parentId) as Row) + 1;
type Mode = 'depth' | 'owner' | 'none';
let mode: Mode = 'depth';
// The expand arrow looks the same across the whole tree (the picture cannot differ per row).
// So a per-row icon goes in front of the text shown in the name cell. Sorting and filtering use the original name.
const byDepth = ['📦', '📁', '📄'];
const byOwner: Record<string, string> = {
'Emma Stone': '⭐',
'Liam Carter': '🔷',
'Mia Parker': '🟢',
'Noah Davis': '🔶',
};
const icon = (row: Row): string =>
mode === 'depth'
? (byDepth[Math.min(depthOf(row), 2)] as string)
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: 'Task',
width: 240,
formatValue: (value: unknown, row: Row) =>
mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: 'Owner', width: 120 },
{ id: 'start', title: 'Start', width: 110 },
{ id: 'end', title: 'End', width: 110 },
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
export const actions = {
mode: (api: GridApi<Row>, value?: string) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
<script setup lang="ts">
import { shallowRef } from 'vue';
import { Grid, type GridApi } from '@maxgrid/vue';
import { actions, options, type Row } from './example';
const api = shallowRef<GridApi<Row> | null>(null);
function onReady(event: { api: GridApi<Row> }) {
api.value = event.api;
}
</script>
<template>
<div class="toolbar">
<select
aria-label="Icons by"
:disabled="!api"
@change="api && actions.mode(api, ($event.target as HTMLSelectElement).value)"
>
<option value="depth" selected>By level</option>
<option value="owner">By owner</option>
<option value="none">None</option>
</select>
</div>
<Grid style="height: 430px" :options="options" @ready="onReady" />
</template>import type { GridApi, GridOptions } from '@maxgrid/vue';
export interface Row {
id: string;
parentId: string | null;
task: string;
owner: string;
start: string;
end: string;
}
const rows: Row[] = [
{
id: 'T1',
parentId: null,
task: 'Release',
owner: 'Emma Stone',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: 'Planning',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: 'Gather requirements',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: 'Screen design',
owner: 'Mia Parker',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: 'Development',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: 'Frontend',
owner: 'Ava Moore',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: 'Backend',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: 'Testing',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: 'Functional test',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: 'Performance test',
owner: 'Ethan Lee',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: 'Operations prep',
owner: 'Emma Stone',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: 'Write training materials',
owner: 'Grace Hall',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row: Row): number =>
row.parentId === null ? 0 : depthOf(byId.get(row.parentId) as Row) + 1;
type Mode = 'depth' | 'owner' | 'none';
let mode: Mode = 'depth';
// The expand arrow looks the same across the whole tree (the picture cannot differ per row).
// So a per-row icon goes in front of the text shown in the name cell. Sorting and filtering use the original name.
const byDepth = ['📦', '📁', '📄'];
const byOwner: Record<string, string> = {
'Emma Stone': '⭐',
'Liam Carter': '🔷',
'Mia Parker': '🟢',
'Noah Davis': '🔶',
};
const icon = (row: Row): string =>
mode === 'depth'
? (byDepth[Math.min(depthOf(row), 2)] as string)
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: 'Task',
width: 240,
formatValue: (value: unknown, row: Row) =>
mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: 'Owner', width: 120 },
{ id: 'start', title: 'Start', width: 110 },
{ id: 'end', title: 'End', width: 110 },
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
export const actions = {
mode: (api: GridApi<Row>, value?: string) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};When you click, the example code is sent to StackBlitz or CodeSandbox. Nothing is sent before you click.
import { Component } from '@angular/core';
import { GridComponent, isGridEvent, type GridApi, type GridEventMessage } from '@maxgrid/angular';
import { actions, options, type Row } from './example';
@Component({
selector: 'app-example-grid',
standalone: true,
imports: [GridComponent],
template: `
<div class="toolbar">
<select
aria-label="Icons by"
[disabled]="!api"
(change)="api && actions.mode(api, $any($event.target).value)"
>
<option value="depth" selected>By level</option>
<option value="owner">By owner</option>
<option value="none">None</option>
</select>
</div>
<mx-grid style="height: 430px" [options]="options" [events]="relayed" (gridEvent)="onEvent($event)" />
`,
})
export class ExampleGridComponent {
readonly options = options;
readonly actions = actions;
readonly relayed = ['ready'] as const;
api: GridApi<Row> | null = null;
onEvent(event: GridEventMessage<Row>): void {
if (isGridEvent(event, 'ready')) {
this.api = event.payload.api;
}
}
}import type { GridApi, GridOptions } from '@maxgrid/angular';
export interface Row {
id: string;
parentId: string | null;
task: string;
owner: string;
start: string;
end: string;
}
const rows: Row[] = [
{
id: 'T1',
parentId: null,
task: 'Release',
owner: 'Emma Stone',
start: '2026-11-02',
end: '2026-12-18',
},
{
id: 'T10',
parentId: 'T1',
task: 'Planning',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-13',
},
{
id: 'T11',
parentId: 'T10',
task: 'Gather requirements',
owner: 'Liam Carter',
start: '2026-11-02',
end: '2026-11-06',
},
{
id: 'T12',
parentId: 'T10',
task: 'Screen design',
owner: 'Mia Parker',
start: '2026-11-09',
end: '2026-11-13',
},
{
id: 'T20',
parentId: 'T1',
task: 'Development',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T21',
parentId: 'T20',
task: 'Frontend',
owner: 'Ava Moore',
start: '2026-11-16',
end: '2026-11-27',
},
{
id: 'T22',
parentId: 'T20',
task: 'Backend',
owner: 'Noah Davis',
start: '2026-11-16',
end: '2026-12-04',
},
{
id: 'T30',
parentId: 'T1',
task: 'Testing',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-18',
},
{
id: 'T31',
parentId: 'T30',
task: 'Functional test',
owner: 'Mia Parker',
start: '2026-12-07',
end: '2026-12-11',
},
{
id: 'T32',
parentId: 'T30',
task: 'Performance test',
owner: 'Ethan Lee',
start: '2026-12-14',
end: '2026-12-18',
},
{
id: 'T2',
parentId: null,
task: 'Operations prep',
owner: 'Emma Stone',
start: '2026-12-07',
end: '2026-12-23',
},
{
id: 'T40',
parentId: 'T2',
task: 'Write training materials',
owner: 'Grace Hall',
start: '2026-12-07',
end: '2026-12-11',
},
];
const byId = new Map(rows.map((row) => [row.id, row]));
const depthOf = (row: Row): number =>
row.parentId === null ? 0 : depthOf(byId.get(row.parentId) as Row) + 1;
type Mode = 'depth' | 'owner' | 'none';
let mode: Mode = 'depth';
// The expand arrow looks the same across the whole tree (the picture cannot differ per row).
// So a per-row icon goes in front of the text shown in the name cell. Sorting and filtering use the original name.
const byDepth = ['📦', '📁', '📄'];
const byOwner: Record<string, string> = {
'Emma Stone': '⭐',
'Liam Carter': '🔷',
'Mia Parker': '🟢',
'Noah Davis': '🔶',
};
const icon = (row: Row): string =>
mode === 'depth'
? (byDepth[Math.min(depthOf(row), 2)] as string)
: mode === 'owner'
? (byOwner[row.owner] ?? '▫️')
: '';
const columns = () => [
{
id: 'task',
title: 'Task',
width: 240,
formatValue: (value: unknown, row: Row) =>
mode === 'none' ? String(value) : `${icon(row)} ${String(value)}`,
},
{ id: 'owner', title: 'Owner', width: 120 },
{ id: 'start', title: 'Start', width: 110 },
{ id: 'end', title: 'End', width: 110 },
];
export const options: GridOptions<Row> = {
columns: columns(),
rows,
rowKey: 'id',
tree: { parentKey: 'parentId', column: 'task', expandDepth: 'all' },
};
export const actions = {
mode: (api: GridApi<Row>, value?: string) => {
mode = value === 'owner' || value === 'none' ? value : 'depth';
api.setColumns(columns());
},
};