Class TreeTable<T>

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.grid.Grid<T>
org.vaadin.firitin.components.grid.VGrid<T>
org.vaadin.firitin.components.TreeTable<T>
Type Parameters:
T - the (super) type of the items in the grid
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.grid.Grid<T>>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.grid.Grid<T>>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.grid.Grid<T>>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.data.event.SortEvent.SortNotifier<com.vaadin.flow.component.grid.Grid<T>,com.vaadin.flow.component.grid.GridSortOrder<T>>, com.vaadin.flow.data.provider.HasDataGenerators<T>, com.vaadin.flow.data.provider.HasDataView<T,Void,com.vaadin.flow.component.grid.dataview.GridDataView<T>>, com.vaadin.flow.data.provider.HasLazyDataView<T,Void,com.vaadin.flow.component.grid.dataview.GridLazyDataView<T>>, com.vaadin.flow.data.provider.HasListDataView<T,com.vaadin.flow.component.grid.dataview.GridListDataView<T>>, Serializable, FluentAttachNotifier<VGrid<T>>, FluentBlurNotifier<com.vaadin.flow.component.grid.Grid<T>,VGrid<T>>, FluentComponent<VGrid<T>>, FluentDetachNotifier<VGrid<T>>, FluentFocusable<com.vaadin.flow.component.grid.Grid<T>,VGrid<T>>, FluentFocusNotifier<com.vaadin.flow.component.grid.Grid<T>,VGrid<T>>, FluentHasSize<VGrid<T>>, FluentHasStyle<VGrid<T>>, FluentHasTheme<VGrid<T>>

public class TreeTable<T> extends VGrid<T>
Design goals for this component: - support lazy loading - no weird HierarchicalDataProvider stuff - support scrollToItem - also support provide same simpler API for non-lazy loading mode that is available for TreeGrid

Non-goals: - workaround oddities of Grid itself

The API is a bit different from TreeGrid, as it is not possible to provide the HiearchicalDataProvider. In the same way as with the official TreeGrid, you can provide the root items and a method to retrieve children for each item using setRootItems(List, SerializableFunction).

Alternatively, you can provide the data in lazy loading mode with HasLazyDataView.setItems(CallbackDataProvider.FetchCallback) or HasLazyDataView.setItems(CallbackDataProvider.FetchCallback, CallbackDataProvider.CountCallback). With these methods you will also need to define TreeTable.TreeTableModel (or at least TreeTable.LeafModel and TreeTable.LevelModel separately) that Grid uses to visualise the hierarchy. At least TreeTable.OpenModel should be instance specific! The fetch callbacks need to take the current expanded state into account and return visible subtrees as defined by the TreeTable.OpenModel.

Whether you were using lazy loading or in-memory data set, you can override the TreeTable.OpenModel that controls whether the node is open or not. TreeGrid calls the setter TreeTable.OpenModel.setOpen(Object, boolean) when a node is opened/closed, so you can persist that detail to your backend if you wish to persist the state for longer than the current session.

See Also: