Class JsTreeTable
- All Implemented Interfaces:
ServerObject
JsTable
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,
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
JsTable.getTotalsTableConfig()
property, it is defined here as a method,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
JsRollupConfig.includeConstituents
property, indicating that aColumn
in the tree may have aColumn.getConstituentType()
property reflecting that the type of cells whereJsTreeTable.TreeSubscription.TreeRowImpl.hasChildren()
is false will be different from usual.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static interface
class
Nested classes/interfaces inherited from class io.deephaven.web.client.api.event.HasEventHandling
HasEventHandling.EventPair<T>
Nested classes/interfaces inherited from interface io.deephaven.web.client.api.ServerObject
ServerObject.Union
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
event.detail is the currently visible viewport data based on the active viewport configuration.static final String
event.detail is the currently visible viewport data based on the active viewport configuration.static final String
event.detail is the currently visible viewport data based on the active viewport configuration.static final String
event.detail is the currently visible viewport data based on the active viewport configuration.static final String
event.detail is the currently visible viewport data based on the active viewport configuration.Fields inherited from class io.deephaven.web.client.api.event.HasEventHandling
INTERNAL_EVENT_RELEASED
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionelemental2.core.JsArray<CustomColumn>
applyCustomColumns
(elemental2.core.JsArray<JsTable.CustomColumnArgUnionType> customColumns) Adding new columns to the table based on other columns using updateView() mechanics.elemental2.core.JsArray<FilterCondition>
applyFilter
(FilterCondition[] filter) 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.elemental2.core.JsArray<Sort>
Applies the given sort to all levels of the tree.void
close()
Indicates that the table will no longer be used, and server resources can be freed.void
Collapses the given node, so that its children and descendants are not visible in the size or the viewport.void
elemental2.promise.Promise<JsTreeTable>
copy()
a new copy of this treetable, so it can be sorted and filtered separately, and maintain a different viewport.void
expand
(JsTreeTable.RowReferenceUnion row, Boolean expandDescendants) Expands the given node, so that its children are visible when they are in the viewport.void
findColumn
(String key) a column with the given name, or throws an exception if it cannot be foundColumn[]
findColumns
(String[] keys) an array with all of the named columns in order, or throws an exception if one cannot be found.elemental2.core.JsArray<Column>
The columns that can be shown in this Tree Table.elemental2.core.JsArray<CustomColumn>
The current list of custom columns added to this Tree Table.@JsNullable String
elemental2.core.JsArray<FilterCondition>
The current filter configuration of this Tree Table.elemental2.promise.Promise<JsTotalsTable>
getGrandTotalsTable
(Object config) elemental2.core.JsArray<Column>
@JsNullable JsLayoutHints
double
getSize()
The current number of rows given the table's contents and the various expand/collapse states of each node.elemental2.core.JsArray<Sort>
getSort()
The current sort configuration of this Tree Tableelemental2.promise.Promise<JsTotalsTable>
getTotalsTable
(Object config) elemental2.promise.Promise<JsTotalsTableConfig>
elemental2.promise.Promise<@TsTypeRef(TreeViewportData.class) Object>
boolean
isClosed()
True if this table has been closed.boolean
Tests if the specified row is expanded.boolean
True if this is a roll-up and will provide the original rows that make up each grouping.boolean
True if this table may receive updates from the server, including size changed events, updated events after initial snapshot.elemental2.promise.Promise<JsTable>
selectDistinct
(Column[] columns) 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.void
setExpanded
(JsTreeTable.RowReferenceUnion row, boolean isExpanded, Boolean expandDescendants) Specifies if the given node should be expanded or collapsed.void
setViewport
(double firstRow, double lastRow, @JsNullable elemental2.core.JsArray<Column> columns, @JsNullable Double updateInterval) Methods inherited from class io.deephaven.web.client.api.lifecycle.HasLifecycle
die, disconnected, nextReconnect, reconnect, refetch
Methods inherited from class io.deephaven.web.client.api.event.HasEventHandling
addEventListener, addEventListenerOneShot, addEventListenerOneShot, failureHandled, fireCriticalEvent, fireCriticalEvent, fireEvent, fireEvent, fireEvent, hasListener, hasListeners, isSuppress, logPrefix, nextEvent, removeEventListener, suppressEvents, unsuppressEvents
-
Field Details
-
EVENT_UPDATED
event.detail is the currently visible viewport data based on the active viewport configuration.- See Also:
-
EVENT_DISCONNECT
event.detail is the currently visible viewport data based on the active viewport configuration.- See Also:
-
EVENT_RECONNECT
event.detail is the currently visible viewport data based on the active viewport configuration.- See Also:
-
EVENT_RECONNECTFAILED
event.detail is the currently visible viewport data based on the active viewport configuration.- See Also:
-
EVENT_REQUEST_FAILED
event.detail is the currently visible viewport data based on the active viewport configuration.- See Also:
-
-
Constructor Details
-
JsTreeTable
-
-
Method Details
-
getConnection
- Specified by:
getConnection
in interfaceServerObject
-
expand
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 is a boolean value, false by default, specifying if the row and all descendants should be fully expanded. Equivalent to `setExpanded(row, true)` with an optional third boolean parameter.- Parameters:
row
-expandDescendants
-
-
collapse
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, false).- Parameters:
row
-
-
setExpanded
public void setExpanded(JsTreeTable.RowReferenceUnion row, boolean isExpanded, @JsOptional Boolean expandDescendants) 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. If node is to be expanded and the third parameter, expandDescendants, is true, then its children will also be expanded.- Parameters:
row
- the row to expand or collapse, either the absolute row index or the row objectisExpanded
- true to expand the row, false to collapseexpandDescendants
- true to expand the row and all descendants, false to expand only the row, defaults to false
-
expandAll
public void expandAll() -
collapseAll
public void collapseAll() -
isExpanded
Tests if the specified row is expanded.- Parameters:
row
- the row to test, either the absolute row index or the row object- Returns:
- boolean true if the row is expanded, false otherwise
-
setViewport
-
getViewportData
-
isClosed
@JsProperty(name="isClosed") public boolean isClosed()True if this table has been closed.- Returns:
- boolean
-
isRefreshing
@JsProperty(name="isRefreshing") public boolean isRefreshing()True if this table may receive updates from the server, including size changed events, updated events after initial snapshot.- Returns:
- boolean
-
close
public void close()Indicates that the table will no longer be used, and server resources can be freed. -
typedTicket
- Specified by:
typedTicket
in interfaceServerObject
-
applySort
Applies the given sort to all levels of the tree. Returns the previous sort in use.- Parameters:
sort
-- Returns:
Sort
array
-
applyFilter
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:
filter
-- Returns:
FilterCondition
array
-
applyCustomColumns
@JsMethod public elemental2.core.JsArray<CustomColumn> applyCustomColumns(elemental2.core.JsArray<JsTable.CustomColumnArgUnionType> customColumns) Adding new columns to the table based on other columns using updateView() mechanics. Rollup tables are supported but Tree tables will throw anUnsupportedOperationException
if this function is called.- Parameters:
customColumns
-- Returns:
CustomColumn
array
-
getDescription
-
getLayoutHints
-
getSize
@JsProperty public double getSize()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:
- double
-
getSort
The current sort configuration of this Tree Table- Returns:
Sort
array.
-
getFilter
The current filter configuration of this Tree Table.- Returns:
FilterCondition
array
-
getCustomColumns
The current list of custom columns added to this Tree Table.- Returns:
CustomColumn
array
-
getColumns
The columns that can be shown in this Tree Table.- Returns:
Column
array
-
findColumn
a column with the given name, or throws an exception if it cannot be found- Parameters:
key
-- Returns:
Column
-
isIncludeConstituents
@JsProperty public boolean isIncludeConstituents()True if this is a roll-up and will provide the original rows that make up each grouping.- Returns:
- boolean
-
getGroupedColumns
-
findColumns
an array with all of the named columns in order, or throws an exception if one cannot be found.- Parameters:
keys
-- Returns:
Column
array
-
selectDistinct
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.
-
getTotalsTableConfig
-
getTotalsTable
-
getGrandTotalsTable
-
copy
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 of dh.TreeTable
-