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

    Interface GanttApi

    The chart controller. attachGrid (grid sync) is provided by grid-sync.ts.

    interface GanttApi {
        external?: GanttExternalApi;
        applyPatch(patch: GanttPatch): void;
        attachGrid<TRow extends object>(
            grid: GridApi<TRow>,
            opts?: {
                gridElement?: HTMLElement | null;
                rowKey?: string;
                unified?: boolean;
            },
        ): () => void;
        collapse(id: string): void;
        collapseAll(): void;
        destroy(): void;
        expand(id: string): void;
        expandAll(): void;
        fitToProject(): void;
        getRowHeight(): number;
        getScrollLeft(): number;
        getScrollTop(): number;
        getSelectedRow(): string | null;
        getVisibleRows(): readonly GanttRow[];
        getZoom(): GanttZoom;
        isCollapsed(id: string): boolean;
        on<K extends keyof GanttEvents>(
            name: K,
            fn: (payload: GanttEvents[K]) => void,
        ): () => void;
        onScrollY(fn: (top: number) => void): () => void;
        reorderTask(taskId: string, drop: DropTarget): ReorderOutcome;
        revertIntent(intentId: string): void;
        scrollToDate(date: string | number, align?: "start" | "center"): void;
        scrollToRow(id: string): void;
        scrollToToday(): void;
        selectRow(id: string | null): void;
        setData(data: GanttData): void;
        setOptions(options: Partial<GanttOptions>): void;
        setRowOrder(order: readonly (string | null)[] | null): void;
        setScrollLeft(left: number): void;
        setScrollTop(top: number): void;
        setZoom(zoom: GanttZoom): void;
    }
    Index
    external?: GanttExternalApi

    Only with verticalScroll: 'external': the connection to the host scroller.

    • Applies task changes from the host (also confirms pending edits).

      Parameters

      Returns void

    • Syncs vertical scroll, row selection and tree collapse with a grid; returns the detach function.

      Type Parameters

      • TRow extends object

      Parameters

      • grid: GridApi<TRow>
      • Optionalopts: { gridElement?: HTMLElement | null; rowKey?: string; unified?: boolean }

      Returns () => void

    • Collapses a summary task.

      Parameters

      • id: string

      Returns void

    • Collapses every summary task.

      Returns void

    • Removes the chart and its listeners.

      Returns void

    • Expands a summary task.

      Parameters

      • id: string

      Returns void

    • Expands every summary task.

      Returns void

    • Picks the zoom that fits the whole project and scrolls to its start.

      Returns void

    • Row height in px.

      Returns number

    • Horizontal scroll position in px.

      Returns number

    • Scroll sync helpers for attachGrid.

      Returns number

    • Id of the selected task, or null.

      Returns string | null

    • The rows currently in the tree (collapsed branches left out).

      Returns readonly GanttRow[]

    • Whether a task is collapsed.

      Parameters

      • id: string

      Returns boolean

    • Subscribes to a chart event; returns the unsubscribe function.

      Type Parameters

      Parameters

      Returns () => void

    • Fires synchronously from every vertical scroll of the chart container (not debounced).

      Parameters

      • fn: (top: number) => void

      Returns () => void

    • Asks the host to move a row, for hosts that drag rows in their grid. Sends task-reorder (parent and previous sibling) when the drop is allowed; otherwise returns the reason and sends nothing. Needs editable: true.

      Parameters

      Returns ReorderOutcome

    • The host refused an edit intent (1.8): the bar returns to its real dates.

      Parameters

      • intentId: string

      Returns void

    • Scrolls so a YYYY-MM-DD date is visible.

      Parameters

      • date: string | number
      • Optionalalign: "start" | "center"

      Returns void

    • Scrolls so a task row is visible.

      Parameters

      • id: string

      Returns void

    • Scrolls to today.

      Returns void

    • Selects a task (or clears with null) without emitting row-select.

      Parameters

      • id: string | null

      Returns void

    • Replaces the data shown.

      Parameters

      Returns void

    • Changes options after creation.

      Parameters

      Returns void

    • Makes the rows follow a given order (a grid's displayed rows, see attachGrid): row i is order[i], null or an unknown id is a blank placeholder row (group header, summary or "load more" row) that has no bar. While it is set the collapse state is ignored. null goes back to the collapse-aware tree.

      Parameters

      • order: readonly (string | null)[] | null

      Returns void

    • Sets the horizontal scroll position in px.

      Parameters

      • left: number

      Returns void

    • Sets the vertical scroll position in px.

      Parameters

      • top: number

      Returns void