맥스그리드 API 레퍼런스
    Preparing search index...

    Interface TreeOptions<TRow>

    트리 데이터 입력과 표시 방식. 데이터는 평면 rows + 부모 키 참조다(docs/design/tree-grouping.md 2장).

    interface TreeOptions<TRow> {
        checkCascade?: boolean;
        column?: string;
        expandDepth?: ExpandDepth;
        expandRecursive?: boolean;
        expandWhen?: (row: TRow, level: number) => boolean;
        filterKeep?: "ancestors" | "subtree";
        guides?: IndentGuides;
        guideStyle?: IndentGuideStyle;
        hasChildren?: (row: TRow) => boolean | undefined;
        loadChildren?: (
            row: TRow,
            ctx: LoadChildrenContext,
        ) => Promise<readonly TRow[]>;
        parentAggregates?: boolean;
        parentKey:
            | Extract<keyof TRow, string>
            | ((row: TRow) => RowKey | null | undefined);
        sortScope?: "all" | "leaves";
        toggleIcon?: ToggleIconOption;
    }

    Type Parameters

    • TRow
    Index
    checkCascade?: boolean

    true면 부모 행을 선택·해제할 때 자손도 함께(체크박스는 일부 선택이면 중간 표시). 기본 false.

    column?: string

    들여쓰기·펼침 버튼을 그릴 컬럼 id. 기본 첫 보이는 컬럼.

    expandDepth?: ExpandDepth

    기본 1: 최상위만 펼쳐져 자식이 보인다.

    expandRecursive?: boolean

    true면 펼칠 때 자손도 모두 펼친다(접기는 그 행만). 기본 false.

    expandWhen?: (row: TRow, level: number) => boolean

    처음 펼침 여부를 행마다 정한다(expandDepth보다 먼저).

    filterKeep?: "ancestors" | "subtree"

    'subtree'면 필터에 일치한 행의 후손까지 보인다(기본 'ancestors': 일치 행 + 조상).

    guides?: IndentGuides

    깊이를 보여 주는 세로 안내선. 기본 'dotted'. 색·굵기는 CSS 변수 --mxg-guide-color·--mxg-guide-width.

    guideStyle?: IndentGuideStyle

    안내선 모양. 기본 'branch'(├ └ 가지선), 'vertical'은 세로선만. guides: false면 무시한다.

    hasChildren?: (row: TRow) => boolean | undefined

    자식이 아직 없어도 펼침 아이콘을 보일지(지연 로딩 자리). undefined면 실제 자식 유무.

    loadChildren?: (row: TRow, ctx: LoadChildrenContext) => Promise<readonly TRow[]>

    자식 지연 로딩. hasChildren(row)가 true인데 자식 행이 아직 없는 행을 펼칠 때 호출한다. 돌려준 행은 addRows와 같은 경로로 들어가므로 각 행의 parentKey가 ctx.key여야 한다. 로딩 중 접거나 행을 교체하면 ctx.signal이 중단되고 늦게 온 응답은 버린다. 실패하면 줄에 오류 표시가 붙고(loadState: 'error') error 이벤트(children-load-failed)가 나가며, 접었다 다시 펼치면 재시도한다.

    parentAggregates?: boolean

    true면 자식이 있는 부모 행의 집계 컬럼 셀에 하위 집계(aggregate)를 보인다(기본 false: 부모도 자기 값을 보인다). 값은 getDisplayRow(i).aggregates로도 읽는다.

    parentKey:
        | Extract<keyof TRow, string>
        | ((row: TRow) => RowKey | null | undefined)

    부모 행의 키를 돌려주는 속성 이름 또는 함수. null/undefined면 최상위.

    sortScope?: "all" | "leaves"

    트리 정렬 범위. 'leaves'면 자식이 없는 형제끼리만 정렬하고 부모는 원래 순서. 기본 'all'.

    toggleIcon?: ToggleIconOption

    펼침 표시 아이콘. 기본 'arrow'. 그룹은 grouping.toggleIcon을 쓴다.