@deephaven/jsapi-types
    Preparing search index...

    Class TreeTable

    Behaves like a Table externally, but data, state, and viewports are managed by an entirely different mechanism, and so reimplemented here.

    Any time a change is made, we build a new request and send it to the server, and wait for the updated state.

    Semantics around getting updates from the server are slightly different - we don't "unset" the viewport here after operations are performed, but encourage the client code to re-set them to the desired position.

    The table size will be -1 until a viewport has been fetched.

    Similar to a table, a Tree Table provides access to subscribed viewport data on the current hierarchy. A different Row type is used within that viewport, showing the depth of that node within the tree and indicating details about whether it has children or is expanded. The Tree Table itself then provides the ability to change if a row is expanded or not. Methods used to control or check if a row should be expanded or not can be invoked on a TreeRow instance, or on the number of the row (thus allowing for expanding/collapsing rows which are not currently visible in the viewport).

    Events and viewports are somewhat different from tables, due to the expense of computing the expanded/collapsed rows and count of children at each level of the hierarchy, and differences in the data that is available.

    • There is no totalSize property.
    • The viewport is not un-set when changes are made to filter or sort, but changes will continue to be streamed in. It is suggested that the viewport be changed to the desired position (usually the first N rows) after any filter/sort change is made. Likewise, TreeTable.getViewportData() will always return the most recent data, and will not wait if a new operation is pending.
    • Custom columns are supported on Rollup tables, but not on Tree tables. If the TreeTable was created client-side, the original Table can have custom columns applied, and the TreeTable can be recreated.
    • Whereas Table has a Table.totalsTableConfig property, it is defined here as a method, TreeTable.getTotalsTableConfig(). This returns a promise so the config can be fetched asynchronously.
    • Totals Tables for trees vary in behavior between tree tables and roll-up tables. This behavior is based on the original flat table used to produce the Tree Table - for a hierarchical table (i.e. Table.treeTable in the query config), the totals will include non-leaf nodes (since they are themselves actual rows in the table), but in a roll-up table, the totals only include leaf nodes (as non-leaf nodes are generated through grouping the contents of the original table). Roll-ups also have the RollupConfig.includeConstituents property, indicating that a Column in the tree may have a Column.constituentType property reflecting that the type of cells where dh.TreeTable.TreeSubscription.TreeRowImpl.hasChildren is false will be different from usual.

    Implements

    Index
    description?: string
    layoutHints?: LayoutHints
    EVENT_DISCONNECT: string

    event.detail is the currently visible viewport data based on the active viewport configuration.

    EVENT_RECONNECT: string

    event.detail is the currently visible viewport data based on the active viewport configuration.

    EVENT_RECONNECTFAILED: string

    event.detail is the currently visible viewport data based on the active viewport configuration.

    EVENT_REQUEST_FAILED: string

    event.detail is the currently visible viewport data based on the active viewport configuration.

    EVENT_UPDATED: string

    event.detail is the currently visible viewport data based on the active viewport configuration.

    • get aggregatedColumns(): Column[]

      Returns the columns that are aggregated.

      Returns Column[]

      array of aggregated columns

    • get columns(): Column[]

      The columns that can be shown in this Tree Table.

      Returns Column[]

      Column array

    • get includeConstituents(): boolean

      true if this is a roll-up and will provide the original rows that make up each grouping.

      Returns boolean

      boolean

    • get isClosed(): boolean

      true if this table has been closed.

      Returns boolean

      boolean

    • get isRefreshing(): boolean

      true if this table may receive updates from the server, including size changed events, updated events after initial snapshot.

      Returns boolean

      boolean

    • get size(): number

      The current number of rows given the table's contents and the various expand/collapse states of each node. (No totalSize is provided at this time; its definition becomes unclear between roll-up and tree tables, especially when considering collapse/expand states).

      Returns number

      double

    • get sort(): Sort[]

      The current sort configuration of this Tree Table.

      Returns Sort[]

      Sort array.

    • Listen for events on this object.

      Type Parameters

      • T

        The type of the data that the event will provide.

      Parameters

      • name: string

        The name of the event to listen for.

      • callback: (e: Event<T>) => void

        A function to call when the event occurs.

      Returns () => void

      Returns a cleanup function.

    • Adding new columns to the table based on other columns using updateView mechanics. Rollup tables are supported but Tree tables will throw an java.lang.UnsupportedOperationException if this function is called.

      Parameters

      Returns CustomColumn[]

      CustomColumn array

    • Applies the given filter to the contents of the tree in such a way that if any node is visible, then any parent node will be visible as well even if that parent node would not normally be visible due to the filter's condition. Returns the previous sort in use.

      Parameters

      Returns FilterCondition[]

      FilterCondition array

    • Applies the given sort to all levels of the tree. Returns the previous sort in use.

      Parameters

      Returns Sort[]

      Sort array

    • Indicates that the table will no longer be used, and server resources can be freed.

      Returns void

    • Collapses the given node, so that its children and descendants are not visible in the size or the viewport. The parameter can be the row index, or the row object itself. Equivalent to setExpanded(row, false).

      Parameters

      • row: number | TreeRow

        The row to collapse - either the absolute row index or the row object.

      Returns void

    • Returns void

    • a new copy of this treetable, so it can be sorted and filtered separately, and maintain a different viewport. Unlike Table, this will not copy the filter or sort, since tree table viewport semantics differ, and without a viewport set, the treetable doesn't evaluate these settings, and they aren't readable on the properties. Expanded state is also not copied.

      Returns Promise<TreeTable>

      Promise of dh.TreeTable

    • Expands the given node, so that its children are visible when they are in the viewport. The parameter can be the row index, or the row object itself. The second parameter controls how descendants are expanded: pass true to expand the row and all descendants, a number to expand to a specified depth relative to the target node, or omit / pass false to expand only the row itself. A depth of 1 is equivalent to a regular expand (one level). A depth of 2 expands the node and its children, etc. Equivalent to setExpanded(row, true) with an optional third parameter. Numeric value is only supported if Features.treeTableExpandToDepth is true.

      Parameters

      • row: number | TreeRow

        The row to expand - either the absolute row index or the row object.

      • OptionalexpandDescendants: number | boolean

        Controls descendant expansion: true for all descendants, a number for depth-limited expansion (relative to the target node), or false/omitted for a single level.

      Returns void

    • Returns void

    • A column with the given name, or throws an exception if it cannot be found.

      Parameters

      • key: string

      Returns Column

      Column

    • An array with all of the named columns in order, or throws an exception if one cannot be found.

      Parameters

      • keys: string[]

      Returns Column[]

      Column array

    • Parameters

      • Optionalconfig: unknown

      Returns Promise<TotalsTable>

    • Parameters

      • Optionalconfig: unknown

      Returns Promise<TotalsTable>

    • Checks whether any event listeners are registered for the given event name.

      Parameters

      • name: string

        The event name.

      Returns boolean

      true if there is at least one listener registered for name; false otherwise.

    • Tests if the specified row is expanded.

      Parameters

      • row: number | TreeRow

        The row to test - either the absolute row index or the row object.

      Returns boolean

      true if the row is expanded, false otherwise.

    • Returns a promise that resolves the next time the named event occurs, with the value of the event's detail. If a timeout is specified and occurs before the event takes place, the promise will reject, otherwise waits indefinitely.

      Type Parameters

      • T

        The type of the event detail.

      Parameters

      • eventName: string

        The event name.

      • OptionaltimeoutInMillis: number

        Optional timeout in milliseconds.

      Returns Promise<Event<T>>

      A promise that resolves with the next matching event.

    • Removes an event listener added to this table.

      Type Parameters

      • T

      Parameters

      • name: string
      • callback: (e: Event<T>) => void

      Returns boolean

    • Given a compatible expanded state string from TreeTable.saveExpandedState(), replaces this table's expanded state with that state. This is a best-effort operation, and on error will have no effect except to log a diagnostic warning. With that said it is possible for the expand operation to fail

      Parameters

      • nodesToRestore: string

        serialized string payload to restore

      Returns void

    • Serializes the current expand

      Returns string

    • Provides Table-like selectDistinct functionality, but with a few quirks, since it is only fetching the distinct values for the given columns in the source table:

      • Rollups may make no sense, since values are aggregated.
      • Values found on orphaned (and removed) nodes will show up in the resulting table, even though they are not in the tree.
      • Values found on parent nodes which are only present in the tree since a child is visible will not be present in the resulting table.

      Parameters

      Returns Promise<Table>

    • Specifies if the given node should be expanded or collapsed. If this node has children, and the value is changed, the size of the table will change. The third parameter, expandDescendants, controls how descendants are expanded when isExpanded is true:

      • true — expand the row and all descendants (expand-all). Descendants with their own collapse or single-expand directives are respected.
      • A number (>= 1) — expand to a specified depth relative to the target node. The depth is relative to the target node: a depth of 1 is equivalent to a regular expand (one level), a depth of 2 expands the node and its children, etc. Behaves like expand-all but stops auto-expanding after the specified number of levels. Descendants with their own collapse or single-expand directives are respected, same as expand-all. Numeric value is only supported if Features.treeTableExpandToDepth is true.
      • false, null, or omitted — expand only the row itself (one level).

      Parameters

      • row: number | TreeRow

        The row to expand or collapse - either the absolute row index or the row object.

      • isExpanded: boolean

        true to expand the row, false to collapse.

      • OptionalexpandDescendants: number | boolean

        Controls descendant expansion: true for all descendants, a number for depth-limited expansion (relative to the target node), or false/omitted for a single level. Defaults to false.

      Returns void

    • Parameters

      • firstRow: number
      • lastRow: number
      • Optionalcolumns: Column[]
      • OptionalupdateInterval: number

      Returns void