Class Grid<T>
- Type Parameters:
T- the grid bean type
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<Grid<T>>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<Grid<T>>,com.vaadin.flow.component.FocusNotifier<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<Grid<T>,,GridSortOrder<T>> com.vaadin.flow.data.provider.HasDataGenerators<T>,com.vaadin.flow.data.provider.HasDataView<T,,Void, GridDataView<T>> com.vaadin.flow.data.provider.HasLazyDataView<T,,Void, GridLazyDataView<T>> com.vaadin.flow.data.provider.HasListDataView<T,,GridListDataView<T>> Serializable
- Direct Known Subclasses:
JmixGroupGrid
Dynamic Height:
Grid has a default height of 400 pixels. It becomes scrollable when its items
overflow the allocated space. In addition to setting any fixed or relative
value, the height of a grid can be set by the number of items in the dataset,
meaning that the grid will grow and shrink based on the row count.
Selection:
Grid selection is not enabled by default. Grid supports single and
multi-select. The former allows the user to select exactly one item while the
latter enables multiple items to be selected. In single selection mode, the
user can select and deselect rows by clicking anywhere on the row. In
multi-select mode, the user can use a checkbox column to select and deselect
rows.
Columns:
Column alignment, freezing (fixed position), grouping, headers and footers,
visibility, and width can be configured. Users can be allowed to resize and
reorder columns.
Sorting:
Any column can be made sortable. Enable sorting to allow the user to sort
items alphabetically, numerically, by date, etc. You can also sort columns
that contain rich and/or custom content by defining which property to sort
by. For example, you can have a column containing a person’s profile picture,
name and email sorted by the person’s last name. Sorting helps users find and
analyze the data, so it’s generally recommended to enable it for all
applicable columns, except in cases where the order of items is an essential
part of the data itself (such as prioritized lists).
Filtering:
Filtering allows the user to quickly find a specific item or subset of items.
You can add filters to Grid columns or use external filter fields.
Item Details:
Item Details are expandable content areas that can be displayed below the
regular content of a row, used to display more information about an item. By
default, an item’s details are toggled by clicking on the item’s row. The
default toggle behavior can be replaced by programmatically toggling the
details visibility, for example, from a button click.
Context Menu:
You can use Context Menu to provide shortcuts to the user. It appears on
right (default) or left click. In a mobile browser, a long press opens the
menu.
Drag and Drop:
Grid supports drag and drop, for example to reorder rows and to drag rows
between grids.
Inline Editing:
Grid can be configured to allow inline editing. Editing can be either
buffered and non-buffered. Buffered means changes must be explicitly
committed, while non-buffered automatically commit changes on blur (when a
field loses focus).
Styling Rows and Columns:
You can style individual cells based on the data, for example, to highlight
changes or important information.
Cell Focus:
Cells can be focused by clicking on a cell or with the keyboard.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA helper base class for creating extensions for the Grid component.static classServer-side component for the<vaadin-grid-column>element.protected static classGrid.DataCommunicatorBuilder<T,U extends com.vaadin.flow.data.provider.ArrayUpdater> Builder forDataCommunicatorobject.protected classClass for managing visible details rows.static enumMulti-sort priority (visually indicated by numbers in column headers) controls how columns are added to the sort order, when a column becomes sorted, or the sort direction of a column is changed.static enumbehavior when parsing nested properties which may containnullvalues in the property chainstatic enumSelection mode representing the built-in selection models in grid.static interfaceprotected static classNested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component> -
Constructor Summary
ConstructorsModifierConstructorDescriptionGrid()Creates a new instance, with page size of 50.Grid(int pageSize) Creates a new instance, with the specified page size.protectedGrid(int pageSize, B dataCommunicatorBuilder) Creates a new instance, with the specified page size and data communicator.protectedGrid(int pageSize, com.vaadin.flow.function.SerializableBiFunction<GridArrayUpdater.UpdateQueueData, Integer, Grid.UpdateQueue> updateQueueBuilder, B dataCommunicatorBuilder) Deprecated, for removal: This API element is subject to removal in a future version.since 24.9 and will be removed in Vaadin 25.Creates a new grid using the givenBackEndDataProvider.Creates a new grid using the given genericDataProvider.Creates a new grid using the givenInMemoryDataProvider.Creates a new grid using the givenListDataProvider.Creates a new grid with an initial set of columns for each of the bean's properties.Creates a new grid with an initial set of columns for each of the bean's properties.protectedCreates a new grid with an initial set of columns for each of the bean's properties.protectedCreates a new grid with an initial set of columns for each of the bean's properties.protectedGrid(Class<T> beanType, com.vaadin.flow.function.SerializableBiFunction<GridArrayUpdater.UpdateQueueData, Integer, Grid.UpdateQueue> updateQueueBuilder, B dataCommunicatorBuilder) Deprecated.since 24.9 and will be removed in Vaadin 25.protectedGrid(Class<T> beanType, com.vaadin.flow.function.SerializableBiFunction<GridArrayUpdater.UpdateQueueData, Integer, Grid.UpdateQueue> updateQueueBuilder, B dataCommunicatorBuilder, boolean autoCreateColumns) Deprecated, for removal: This API element is subject to removal in a future version.since 24.9 and will be removed in Vaadin 25.Grid(Collection<T> items) Creates a new grid using the given collection of items using aListDataProvider. -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddCellFocusListener(com.vaadin.flow.component.ComponentEventListener<CellFocusEvent<T>> listener) Adds a listener to the grid that will be notified, when a cell has been focused.Adds a new text column to thisGridwith a renderer and default column factory.protected <C extends Grid.Column<T>>
CaddColumn(com.vaadin.flow.data.renderer.Renderer<T> renderer, BiFunction<com.vaadin.flow.data.renderer.Renderer<T>, String, C> columnFactory) Adds a new text column to thisGridwith a renderer and column factory provided.Adds a new text column to thisGridwith a value provider and default column factory.protected <C extends Grid.Column<T>>
CaddColumn(com.vaadin.flow.function.ValueProvider<T, ?> valueProvider, BiFunction<com.vaadin.flow.data.renderer.Renderer<T>, String, C> columnFactory) Adds a new text column to thisGridwith a value provider and column factory provided.<V extends Comparable<? super V>>
Grid.Column<T>Adds a new text column to thisGridwith a value provider and sorting properties.The value is converted to a JSON value by usingJsonSerializer.toJson(Object).Adds a new column for the given property name with the default column factory.protected <C extends Grid.Column<T>>
CaddColumn(String propertyName, BiFunction<com.vaadin.flow.data.renderer.Renderer<T>, String, C> columnFactory) Adds a new column for the given property name with the column factory provided.com.vaadin.flow.shared.RegistrationaddColumnReorderListener(com.vaadin.flow.component.ComponentEventListener<ColumnReorderEvent<T>> listener) Adds a column reorder listener to this component.com.vaadin.flow.shared.RegistrationaddColumnResizeListener(com.vaadin.flow.component.ComponentEventListener<ColumnResizeEvent<T>> listener) Adds a column resize listener to this component.voidaddColumns(String... propertyNames) Adds a new columns for the given property names.<V extends com.vaadin.flow.component.Component>
Grid.Column<T>addComponentColumn(com.vaadin.flow.function.ValueProvider<T, V> componentProvider) Adds a new column that shows components.Adds a new context-menu for this grid.com.vaadin.flow.shared.RegistrationaddDataGenerator(com.vaadin.flow.data.provider.DataGenerator<T> dataGenerator) com.vaadin.flow.shared.RegistrationaddDragEndListener(com.vaadin.flow.component.ComponentEventListener<GridDragEndEvent<T>> listener) Adds a drag end listener to this component.com.vaadin.flow.shared.RegistrationaddDragStartListener(com.vaadin.flow.component.ComponentEventListener<GridDragStartEvent<T>> listener) Adds a drag start listener to this component.com.vaadin.flow.shared.RegistrationaddDropListener(com.vaadin.flow.component.ComponentEventListener<GridDropEvent<T>> listener) Adds a drop listener to this component.protected HeaderRowcom.vaadin.flow.shared.RegistrationaddItemClickListener(com.vaadin.flow.component.ComponentEventListener<ItemClickEvent<T>> listener) Adds an item click listener to this component.com.vaadin.flow.shared.RegistrationaddItemDoubleClickListener(com.vaadin.flow.component.ComponentEventListener<ItemDoubleClickEvent<T>> listener) Adds an item double click listener to this component.com.vaadin.flow.shared.RegistrationaddSelectionListener(com.vaadin.flow.data.selection.SelectionListener<Grid<T>, T> listener) Adds a selection listener to the current selection model.com.vaadin.flow.shared.RegistrationaddSortListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.data.event.SortEvent<Grid<T>, GridSortOrder<T>>> listener) voidaddThemeVariants(GridVariant... variants) Adds theme variants to the component.com.vaadin.flow.shared.RegistrationaddValueProvider(String property, com.vaadin.flow.function.ValueProvider<T, ?> valueProvider) Adds a ValueProvider to this Grid that is not tied to a Column.Adds a new footer row to the bottom of the existing footer rows.Adds a new header row to the bottom of the existing header rows.Use this grid as a multiselect inBinder.Use this grid as a single select inBinder.protected static intvoidconfigureBeanType(Class<T> beanType, boolean autoCreateColumns) Sets the bean type this grid is bound to and optionally adds a set of columns for each of the bean's properties.protected Grid.Column<T>createColumn(com.vaadin.flow.data.renderer.Renderer<T> renderer, String columnId) Deprecated.This method should not be used outside.protected StringcreateColumnId(boolean increment) protected GridArrayUpdatercreateDefaultArrayUpdater(com.vaadin.flow.function.SerializableBiFunction<GridArrayUpdater.UpdateQueueData, Integer, Grid.UpdateQueue> updateQueueFactory) Deprecated.since 24.9.protected Grid<T>.DetailsManagerCreates a new Editor instance.protected com.vaadin.flow.function.SerializableComparator<T>Creates a comparator for grid to sort rows.voidThis method is a shorthand that delegates to the currently set selection model.voidThis method is a shorthand that delegates to the currently set selection model.protected voidgeneratePartData(T item, elemental.json.JsonObject jsonObject) protected voidgenerateSelectableData(T item, elemental.json.JsonObject jsonObject) Gets the aria-label of the component.protected GridArrayUpdaterReturns the Class of bean this Grid is constructed with viaGrid(Class).Gets the function that is used for generating CSS class names for rows in this grid.protected final Grid.Column<T>getColumnByInternalId(String internalId) Gets aGrid.Columnof this grid by its internal id (_flowId).getColumnByKey(String columnKey) Gets aGrid.Columnof this grid by its key.protected List<io.jmix.groupgridflowui.kit.vaadin.grid.ColumnLayer>Gets the current column rendering mode.List<Grid.Column<T>>Gets an unmodifiable list of allGrid.Columns currently in thisGrid.com.vaadin.flow.data.provider.DataCommunicator<T>Returns the data communicator of this Grid.com.vaadin.flow.data.provider.DataProvider<T,?> Returns the data provider of this grid.protected BiFunction<com.vaadin.flow.data.renderer.Renderer<T>,String, Grid.Column<T>> Gives a reference to the column factory.protected HeaderRowcom.vaadin.flow.function.SerializablePredicate<T>Gets the active drag filter.com.vaadin.flow.function.SerializablePredicate<T>Gets the active drop filter.Gets the drop mode of this drop target.Gets the editor.com.vaadin.flow.component.ComponentReturns the component that is displayed when the grid is empty.Returns the text that is displayed when the grid is empty.Gets all of the footer rows in the Grid, in order from top to bottom.Gets the generic data view for the grid.Gets all of the header rows in the Grid, in order from top to bottom.Gets the lazy data view for the grid.Gets the list data view for the grid.Get the behavior when facing nestednullvalues.intGets the current page size, which is the number of items fetched at a time from the dataprovider.Gets the function that is used for generating CSS part names for rows in this grid.com.vaadin.flow.data.binder.PropertySet<T>ReturnsPropertySetof bean this Grid is constructed with viaGrid(Class).This method is a shorthand that delegates to the currently set selection model.Returns the selection mode for this grid.Returns the selection model for this grid.com.vaadin.flow.component.shared.SelectionPreservationModeGets the selection preservation mode.Gets an list of the current sort orders in the Grid.com.vaadin.flow.component.shared.Tooltip.TooltipPositionGets the tooltip position relative to the cell that is being hovered or focused.protected StringGets property name for unique key in row's generated JSON.Gets optional value provider for unique key in row's generated JSON.protected voidprotected io.jmix.groupgridflowui.kit.vaadin.grid.ColumnLayerinsertColumnLayer(int index, List<io.jmix.groupgridflowui.kit.vaadin.grid.AbstractColumn<?>> columns) Creates a new layer from the provided columns, inserts the layer into given index and returns the new layer.booleanGets whether grid's height is defined by the number of its rows.booleanReturns whether column reordering is allowed.booleanisDetailsVisible(T item) Returns the visibility of details component for given item.booleanGets whether the item details are opened and closed by clicking the rows or not.booleanGets whether multiple column sorting is enabled on the client-side.booleanGets whether rows of the grid can be dragged.protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidCallback which is called if a new data provider is set or any change happen in the current data provider (anDataChangeEventevent is fired).protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent) voidonEnabledStateChanged(boolean enabled) Adds a new footer row on the top of the existing footer rows.Adds a new header row on the top of the existing header rows.voidUpdates thewidthof all columns which haveautoWidthset totrue.voidRemoves all columns from this Grid.voidRemoves all footer rows from the grid.voidRemoves all header rows from the grid.voidremoveColumn(Grid.Column<T> column) Removes a column from the Grid.voidremoveColumnByKey(String columnKey) Removes a column with the given column key from the Grid.protected voidremoveColumnLayer(io.jmix.groupgridflowui.kit.vaadin.grid.ColumnLayer layer) Removes the given layer and moves the columns on the lower level to its place.voidremoveColumns(Grid.Column<T>... columns) Removes columns from the Grid.voidremoveFooterRow(FooterRow footerRow) Removes the footer row from the grid.voidremoveHeaderRow(HeaderRow headerRow) Removes the header row from the grid.voidremoveThemeVariants(GridVariant... variants) Removes theme variants from the component.voidScrolls to the last data row of the grid.voidscrollToIndex(int rowIndex) Scrolls to the given row index.voidscrollToItem(T item) Scrolls to the row presenting the given item.voidScrolls to the beginning of the first data row.voidThis method is a shorthand that delegates to the currently set selection model.voidsetAllRowsVisible(boolean allRowsVisible) Iftrue, the grid's height is defined by its rows.voidsetAriaLabel(String ariaLabel) Set the aria-label of the component to the given text.voidsetClassNameGenerator(com.vaadin.flow.function.SerializableFunction<T, String> classNameGenerator) Deprecated.setPartNameGenerator(com.vaadin.flow.function.SerializableFunction<T, java.lang.String>)should be used instead.protected voidsetColumnKey(String key, Grid.Column column) Sets a user-defined identifier for given column.voidsetColumnOrder(Grid.Column<T>... columns) Sets a new column order for the grid.voidsetColumnOrder(List<Grid.Column<T>> columns) Sets a new column order for the grid.voidsetColumnRendering(ColumnRendering columnRendering) Sets the mode for rendering columns in the grid.voidsetColumnReorderingAllowed(boolean columnReorderingAllowed) Sets whether or not column reordering is allowed.voidsetColumns(String... propertyNames) Sets the columns and their order based on the given properties.voidsetDataProvider(com.vaadin.flow.data.provider.DataProvider<T, ?> dataProvider) Sets a generic data provider for the Grid to use.static voidSets the default multi-sort priority to use for all Grid instances.voidsetDetailsVisible(T item, boolean visible) Sets the visibility of details component for given item.voidsetDetailsVisibleOnClick(boolean detailsVisibleOnClick) Sets whether the item details can be opened and closed by clicking the rows or not.voidsetDragDataGenerator(String type, com.vaadin.flow.function.SerializableFunction<T, String> dragDataGenerator) Sets a generator function for customizing drag data.voidsetDragFilter(com.vaadin.flow.function.SerializablePredicate<T> dragFilter) Sets the drag filter for this drag source.voidsetDropFilter(com.vaadin.flow.function.SerializablePredicate<T> dropFilter) Sets the drop filter for this drag target.voidsetDropMode(GridDropMode dropMode) Sets the drop mode of this drop target.voidsetEmptyStateComponent(com.vaadin.flow.component.Component emptyStateComponent) Sets the component to be displayed when the grid is empty.voidsetEmptyStateText(String emptyStateText) Sets the text to be displayed when the grid is empty.voidsetItemDetailsRenderer(com.vaadin.flow.data.renderer.Renderer<T> renderer) Set the renderer to use for displaying the item details rows in this grid.voidsetItemSelectableProvider(com.vaadin.flow.function.SerializablePredicate<T> provider) Sets a predicate to check whether a specific item in the grid may be selected or deselected by the user.setItemsPageable(Grid.SpringData.FetchCallback<org.springframework.data.domain.Pageable, T> fetchCallback) Supply items lazily with a callback from a backend based on a Spring Data Pageable.setItemsPageable(Grid.SpringData.FetchCallback<org.springframework.data.domain.Pageable, T> fetchCallback, Grid.SpringData.CountCallback<org.springframework.data.domain.Pageable> countCallback) Supply items lazily with callbacks: the first one fetches a list of items from a backend based on a Spring Data Pageable, the second provides the exact count of items in the backend.voidsetMultiSort(boolean multiSort) Sets whether multiple column sorting is enabled on the client-side.voidsetMultiSort(boolean multiSort, boolean onShiftClickOnly) Sets whether multiple column sorting is enabled on the client-side.voidsetMultiSort(boolean multiSort, Grid.MultiSortPriority priority) Sets whether multiple column sorting is enabled on the client-side.voidsetMultiSort(boolean multiSort, Grid.MultiSortPriority priority, boolean onShiftClickOnly) Sets whether multiple column sorting is enabled on the client-side.voidsetNestedNullBehavior(Grid.NestedNullBehavior nestedNullBehavior) Set the behavior when facing nestednullvalues.voidsetPageSize(int pageSize) Sets the page size, which is the number of items fetched at a time from the data provider.voidsetPartNameGenerator(com.vaadin.flow.function.SerializableFunction<T, String> partNameGenerator) Sets the function that is used for generating CSS part names for all the cells in the rows in this grid.voidsetRowsDraggable(boolean rowsDraggable) Sets whether the user can drag the grid rows or not.voidsetSelectionDragDetails(int draggedItemsCount, Map<String, String> dragData) Sets explicit drag operation details for when the user is dragging the selected items.setSelectionMode(Grid.SelectionMode selectionMode) Sets the grid's selection mode.protected voidsetSelectionModel(GridSelectionModel<T> model, Grid.SelectionMode selectionMode) Sets the selection model for the grid.voidsetSelectionPreservationMode(com.vaadin.flow.component.shared.SelectionPreservationMode selectionPreservationMode) Sets the selection preservation mode.voidsetSortableColumns(String... propertyNames) Sets the defined columns as sortable, based on the given property names.voidsetTooltipGenerator(com.vaadin.flow.function.SerializableFunction<T, String> tooltipGenerator) Sets the function that is used for generating tooltip text for all cells in this grid.voidsetTooltipPosition(com.vaadin.flow.component.shared.Tooltip.TooltipPosition position) Sets the tooltip position relative to the cell that is being hovered or focused.protected voidsetUniqueKeyProperty(String uniqueKeyProperty) Sets property name for unique key in row's generated JSON.protected voidsetUniqueKeyProvider(com.vaadin.flow.function.ValueProvider<T, String> uniqueKeyProvider) Sets value provider for unique key in row's generated JSON.voidsort(List<GridSortOrder<T>> order) Forces a defined sort order for the columns in the Grid.protected voidMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, focus, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.data.provider.HasLazyDataView
setItems, setItemsMethods inherited from interface com.vaadin.flow.data.provider.HasListDataView
setItems, setItemsMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
-
Constructor Details
-
Grid
public Grid()Creates a new instance, with page size of 50. -
Grid
Creates a new grid using the given genericDataProvider.- Parameters:
dataProvider- the data provider, notnull
-
Grid
Creates a new grid using the givenBackEndDataProvider.- Parameters:
dataProvider- the data provider, notnull
-
Grid
Creates a new grid using the givenInMemoryDataProvider.- Parameters:
inMemoryDataProvider- the data provider, notnull
-
Grid
Creates a new grid using the givenListDataProvider.- Parameters:
dataProvider- the data provider, notnull
-
Grid
Creates a new grid using the given collection of items using aListDataProvider.- Parameters:
items- the collection of items, notnull
-
Grid
public Grid(int pageSize) Creates a new instance, with the specified page size.The page size influences the
Query.getLimit()sent by the client, but it's up to the webcomponent to determine the actual query limit, based on the height of the component and scroll position. Usually the limit is 3 times the page size (e.g. 150 items with a page size of 50).- Parameters:
pageSize- the page size. Must be greater than zero.
-
Grid
Creates a new grid with an initial set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keysand the property captions will be used as thecolumn headers. The generated columns will be sortable by default, if the property isComparable.When autoCreateColumns is
true, only the direct properties of the bean are included and they will be in alphabetical order. UsesetColumns(String...)to define which properties to include and in which order. You can also add a column for an individual property withaddColumn(String). Both of these methods support also sub-properties with dot-notation, eg."property.nestedProperty".- Parameters:
beanType- the bean type to use, notnullautoCreateColumns- whentrue, columns are created automatically for the properties of the beanType
-
Grid
Creates a new grid with an initial set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keysand the property captions will be used as thecolumn headers. The generated columns will be sortable by default, if the property isComparable.By default, only the direct properties of the bean are included and they will be in alphabetical order. Use
setColumns(String...)to define which properties to include and in which order. You can also add a column for an individual property withaddColumn(String). Both of these methods support also sub-properties with dot-notation, eg."property.nestedProperty".- Parameters:
beanType- the bean type to use, notnull
-
Grid
@Deprecated(since="24.9") protected Grid(Class<T> beanType, com.vaadin.flow.function.SerializableBiFunction<GridArrayUpdater.UpdateQueueData, Integer, Grid.UpdateQueue> updateQueueBuilder, B dataCommunicatorBuilder) Deprecated.since 24.9 and will be removed in Vaadin 25. UseGrid(Class, DataCommunicatorBuilder)instead.Creates a new grid with an initial set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keysand the property captions will be used as thecolumn headers.You can add columns for nested properties of the bean with
addColumn(String).- Type Parameters:
B- the data communicator builder typeU- the GridArrayUpdater type- Parameters:
beanType- the bean type to use, notnullupdateQueueBuilder- the builder for newGrid.UpdateQueueinstancedataCommunicatorBuilder- Builder forDataCommunicatorimplementation this Grid uses to handle all data communication.
-
Grid
Creates a new grid with an initial set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keysand the property captions will be used as thecolumn headers.You can add columns for nested properties of the bean with
addColumn(String).- Type Parameters:
B- the data communicator builder typeU- the GridArrayUpdater type- Parameters:
beanType- the bean type to use, notnulldataCommunicatorBuilder- Builder forDataCommunicatorimplementation this Grid uses to handle all data communication.
-
Grid
@Deprecated(since="24.9", forRemoval=true) protected Grid(Class<T> beanType, com.vaadin.flow.function.SerializableBiFunction<GridArrayUpdater.UpdateQueueData, Integer, Grid.UpdateQueue> updateQueueBuilder, B dataCommunicatorBuilder, boolean autoCreateColumns) Deprecated, for removal: This API element is subject to removal in a future version.since 24.9 and will be removed in Vaadin 25. UseGrid(Class, DataCommunicatorBuilder, boolean)instead.Creates a new grid with an initial set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keysand the property captions will be used as thecolumn headers.When autoCreateColumns is
true, only the direct properties of the bean are included and they will be in alphabetical order. UsesetColumns(String...)to define which properties to include and in which order. You can also add a column for an individual property withaddColumn(String). Both of these methods support also sub-properties with dot-notation, eg."property.nestedProperty".- Type Parameters:
B- the data communicator builder typeU- the GridArrayUpdater type- Parameters:
beanType- the bean type to use, notnullupdateQueueBuilder- the builder for newGrid.UpdateQueueinstancedataCommunicatorBuilder- Builder forDataCommunicatorimplementation this Grid uses to handle all data communication.autoCreateColumns- whentrue, columns are created automatically for the properties of the beanType
-
Grid
Creates a new grid with an initial set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keysand the property captions will be used as thecolumn headers.When autoCreateColumns is
true, only the direct properties of the bean are included and they will be in alphabetical order. UsesetColumns(String...)to define which properties to include and in which order. You can also add a column for an individual property withaddColumn(String). Both of these methods support also sub-properties with dot-notation, eg."property.nestedProperty".- Type Parameters:
B- the data communicator builder typeU- the GridArrayUpdater type- Parameters:
beanType- the bean type to use, notnulldataCommunicatorBuilder- Builder forDataCommunicatorimplementation this Grid uses to handle all data communication.autoCreateColumns- whentrue, columns are created automatically for the properties of the beanType
-
Grid
@Deprecated(since="24.9", forRemoval=true) protected Grid(int pageSize, com.vaadin.flow.function.SerializableBiFunction<GridArrayUpdater.UpdateQueueData, Integer, Grid.UpdateQueue> updateQueueBuilder, B dataCommunicatorBuilder) Deprecated, for removal: This API element is subject to removal in a future version.since 24.9 and will be removed in Vaadin 25. UseGrid(int, DataCommunicatorBuilder)instead.Creates a new instance, with the specified page size and data communicator.The page size influences the
Query.getLimit()sent by the client, but it's up to the webcomponent to determine the actual query limit, based on the height of the component and scroll position. Usually the limit is 3 times the page size (e.g. 150 items with a page size of 50).- Type Parameters:
B- the data communicator builder typeU- the GridArrayUpdater type- Parameters:
pageSize- the page size. Must be greater than zero.updateQueueBuilder- the builder for newGrid.UpdateQueueinstancedataCommunicatorBuilder- Builder forDataCommunicatorimplementation this Grid uses to handle all data communication.
-
Grid
protected Grid(int pageSize, B dataCommunicatorBuilder) Creates a new instance, with the specified page size and data communicator.The page size influences the
Query.getLimit()sent by the client, but it's up to the webcomponent to determine the actual query limit, based on the height of the component and scroll position. Usually the limit is 3 times the page size (e.g. 150 items with a page size of 50).- Type Parameters:
B- the data communicator builder typeU- the GridArrayUpdater type- Parameters:
pageSize- the page size. Must be greater than zero.dataCommunicatorBuilder- Builder forDataCommunicatorimplementation this Grid uses to handle all data communication.
-
-
Method Details
-
setDefaultMultiSortPriority
Sets the default multi-sort priority to use for all Grid instances.This method should be called before creating any Grid instances. Changing this setting does not affect the default for existing Grids. Use
setMultiSort(boolean, MultiSortPriority)to provide a custom multi-sort priority overriding the default priority for a single Grid.- Parameters:
priority- the multi-sort priority to be used by all grid instances
-
initConnector
protected void initConnector() -
createDefaultArrayUpdater
@Deprecated(since="24.9") protected GridArrayUpdater createDefaultArrayUpdater(com.vaadin.flow.function.SerializableBiFunction<GridArrayUpdater.UpdateQueueData, Integer, Grid.UpdateQueue> updateQueueFactory) Deprecated.since 24.9. In Vaadin 25, this method will continue to exist without theupdateQueueFactoryparameter. -
addColumn
Adds a new text column to thisGridwith a value provider and default column factory. The value is converted to String when sent to the client by usingString.valueOf(Object).NOTE: For displaying components, see
addComponentColumn(ValueProvider). For using build-in renderers, seeaddColumn(Renderer).Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
removeColumn(Column)to avoid sending extra data.NOTE: This method is a shorthand for
addColumn(ValueProvider, BiFunction)- Parameters:
valueProvider- the value provider- Returns:
- the created column
- See Also:
-
addColumn
protected <C extends Grid.Column<T>> C addColumn(com.vaadin.flow.function.ValueProvider<T, ?> valueProvider, BiFunction<com.vaadin.flow.data.renderer.Renderer<T>, String, C> columnFactory) Adds a new text column to thisGridwith a value provider and column factory provided. The value is converted to String when sent to the client by usingString.valueOf(Object).NOTE: For displaying components, see
addComponentColumn(ValueProvider). For using build-in renderers, seeaddColumn(Renderer).Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
removeColumn(Column)to avoid sending extra data.- Parameters:
valueProvider- the value providercolumnFactory- the method that creates a new column instance for thisGridinstance.- Returns:
- the created column
- See Also:
-
addComponentColumn
public <V extends com.vaadin.flow.component.Component> Grid.Column<T> addComponentColumn(com.vaadin.flow.function.ValueProvider<T, V> componentProvider) Adds a new column that shows components.This is a shorthand for
addColumn(Renderer)with aComponentRenderer.NOTE: Using
ComponentRendereris not as efficient as the built in renderers or usingLitRenderer.Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
removeColumn(Column)to avoid sending extra data.- Type Parameters:
V- the component type- Parameters:
componentProvider- a value provider that will return a component for the given item- Returns:
- the new column
- See Also:
-
addColumn
public <V extends Comparable<? super V>> Grid.Column<T> addColumn(com.vaadin.flow.function.ValueProvider<T, V> valueProvider, String... sortingProperties) Adds a new text column to thisGridwith a value provider and sorting properties.The value is converted to a JSON value by usingJsonSerializer.toJson(Object). The sorting properties are used to configure backend sorting for this column. In-memory sorting is automatically configured using the return type of the givenValueProvider.Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
removeColumn(Column)to avoid sending extra data.- Type Parameters:
V- the type of the column- Parameters:
valueProvider- the value providersortingProperties- the sorting properties to use with this column- Returns:
- the created column
- See Also:
-
addColumn
Adds a new text column to thisGridwith a renderer and default column factory.See implementations of the
Rendererinterface for built-in renderer options with type safe APIs. For a renderer using template binding, useLitRenderer.of(String).NOTE: You can add component columns easily using the
addComponentColumn(ValueProvider), but usingComponentRendereris not as efficient as the built in renderers or usingLitRenderer.Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
removeColumn(Column)to avoid sending extra data.NOTE: This method is a shorthand for
addColumn(Renderer, BiFunction)- Parameters:
renderer- the renderer used to create the grid cell structure- Returns:
- the created column
- See Also:
-
addColumn
protected <C extends Grid.Column<T>> C addColumn(com.vaadin.flow.data.renderer.Renderer<T> renderer, BiFunction<com.vaadin.flow.data.renderer.Renderer<T>, String, C> columnFactory) Adds a new text column to thisGridwith a renderer and column factory provided.See implementations of the
Rendererinterface for built-in renderer options with type safe APIs. For a renderer using template binding, useLitRenderer.of(String).NOTE: You can add component columns easily using the
addComponentColumn(ValueProvider), but usingComponentRendereris not as efficient as the built in renderers or usingLitRenderer.Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
removeColumn(Column)to avoid sending extra data.- Parameters:
renderer- the renderer used to create the grid cell structurecolumnFactory- the method that creates a new column instance for thisGridinstance.- Returns:
- the created column
- See Also:
-
addColumn(Renderer)LitRenderer.of(String)addComponentColumn(ValueProvider)removeColumn(Column)
-
createColumn
@Deprecated protected Grid.Column<T> createColumn(com.vaadin.flow.data.renderer.Renderer<T> renderer, String columnId) Deprecated.This method should not be used outside.getDefaultColumnFactory()should be used instead.Creates a new column instance for thisGridinstance.This method must not return
null.- Parameters:
renderer- the renderer used to create the grid cell structurecolumnId- internal column id- Returns:
- column instance
- See Also:
-
createColumnId(boolean)Renderer
-
getDefaultColumnFactory
protected BiFunction<com.vaadin.flow.data.renderer.Renderer<T>,String, getDefaultColumnFactory()Grid.Column<T>> Gives a reference to the column factory.This method must not return
null.- Returns:
- method for column creation
-
addColumn
Adds a new column for the given property name with the default column factory. The property values are converted to Strings in the grid cells. The property's full name will be used as thecolumn keyand the property caption will be used as thecolumn header.You can add columns for nested properties with dot notation, eg.
"property.nestedProperty"If the property is
Comparable, the created column is sortable by default. This can be changed with theGrid.Column.setSortable(boolean)method.Note: This method can only be used for a Grid created from a bean type with
Grid(Class).Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
removeColumn(Column)to avoid sending extra data.Note: This method is a shorthand for
addColumn(String, BiFunction)- Parameters:
propertyName- the property name of the new column, notnull- Returns:
- the created column
- See Also:
-
addColumn
protected <C extends Grid.Column<T>> C addColumn(String propertyName, BiFunction<com.vaadin.flow.data.renderer.Renderer<T>, String, C> columnFactory) Adds a new column for the given property name with the column factory provided. The property values are converted to Strings in the grid cells. The property's full name will be used as thecolumn keyand the property caption will be used as thecolumn header.You can add columns for nested properties with dot notation, eg.
"property.nestedProperty"If the property is
Comparable, the created column is sortable by default. This can be changed with theGrid.Column.setSortable(boolean)method.Note: This method can only be used for a Grid created from a bean type with
Grid(Class).Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
removeColumn(Column)to avoid sending extra data.- Parameters:
propertyName- the property name of the new column, notnullcolumnFactory- the method that creates a new column instance for thisGridinstance.- Returns:
- the created column
- See Also:
-
addColumns
Adds a new columns for the given property names. The property values are converted to Strings in the grid cells. The properties' full names will be used as thecolumn keyand the properties' caption will be used as thecolumn header.You can add columns for nested properties with dot notation, eg.
"property.nestedProperty"If the property is
Comparable, the created column is sortable by default. This can be changed with theGrid.Column.setSortable(boolean)method.Note: This method can only be used for a Grid created from a bean type with
Grid(Class).Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
removeColumn(Column)to avoid sending extra data.- Parameters:
propertyNames- the property names of the new columns, notnull- See Also:
-
setColumns
Sets the columns and their order based on the given properties.This is a shortcut for removing all columns and then calling
addColumn(String)for each of the given propertyNames.You can add columns for nested properties with dot notation, eg.
"property.nestedProperty"Note that this also resets the headers and footers.
Note: This method can only be used for a Grid created from a bean type with
Grid(Class).- Parameters:
propertyNames- the properties to create columns for
-
setSortableColumns
Sets the defined columns as sortable, based on the given property names.This is a shortcut for setting all columns not sortable and then calling
Grid.Column.setSortable(boolean)for each of the columns defined by the given propertyNames.You can set sortable columns for nested properties with dot notation, eg.
"property.nestedProperty"Note: This method can only be used for a Grid created from a bean type with
Grid(Class).- Parameters:
propertyNames- the property names used to reference the columns- Throws:
IllegalArgumentException- if any of the propertyNames refers to a non-existing column- See Also:
-
setColumnKey
Sets a user-defined identifier for given column.- Parameters:
column- the columnkey- the user-defined identifier- See Also:
-
createColumnId
-
prependHeaderRow
Adds a new header row on the top of the existing header rows.If there are no existing header rows, this will create the first row.
- Returns:
- the created header row
-
appendHeaderRow
Adds a new header row to the bottom of the existing header rows.If there are no existing header rows, this will create the first row.
- Returns:
- the created header row
-
removeHeaderRow
Removes the header row from the grid. Note that the default header row can be removed only if it is the only header row.- Parameters:
headerRow- the header row to remove- Throws:
UnsupportedOperationException- if default row is being removed while there are other header rowsNoSuchElementException- if the header row cannot be found- See Also:
-
removeAllHeaderRows
public void removeAllHeaderRows()Removes all header rows from the grid.- See Also:
-
addFirstHeaderRow
-
getDefaultHeaderRow
-
getColumnLayers
-
getHeaderRows
Gets all of the header rows in the Grid, in order from top to bottom.- Returns:
- the header rows of the Grid
-
addThemeVariants
Adds theme variants to the component.- Parameters:
variants- theme variants to add
-
removeThemeVariants
Removes theme variants from the component.- Parameters:
variants- theme variants to remove
-
insertColumnLayer
protected io.jmix.groupgridflowui.kit.vaadin.grid.ColumnLayer insertColumnLayer(int index, List<io.jmix.groupgridflowui.kit.vaadin.grid.AbstractColumn<?>> columns) Creates a new layer from the provided columns, inserts the layer into given index and returns the new layer.The user of this method should make sure that the DOM corresponds the column layer structure.
- Parameters:
index- the index to insertcolumns- the column components that the new layer will wrap- Returns:
- the new layer
-
removeColumnLayer
protected void removeColumnLayer(io.jmix.groupgridflowui.kit.vaadin.grid.ColumnLayer layer) Removes the given layer and moves the columns on the lower level to its place.- Parameters:
layer- the layer to remove, not the bottom layer
-
setDataProvider
Sets a generic data provider for the Grid to use.Use this method when none of the
setItemsmethods are applicable, e.g. when having a data provider with filter that cannot be transformed toDataProvider<T, Void>.- Parameters:
dataProvider- DataProvider instance to use, notnull
-
getDataProvider
Returns the data provider of this grid.To get information and control over the items in the grid, use either
getListDataView()orgetLazyDataView()instead.- Returns:
- the data provider of this grid, not
null
-
setItems
- Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void, GridDataView<T>>
-
setItems
public GridDataView<T> setItems(com.vaadin.flow.data.provider.InMemoryDataProvider<T> inMemoryDataProvider) - Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void, GridDataView<T>>
-
getGenericDataView
Gets the generic data view for the grid. This data view should only be used whengetListDataView()orgetLazyDataView()is not applicable for the underlying data provider.- Specified by:
getGenericDataViewin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void, GridDataView<T>> - Returns:
- the generic
DataViewimplementation for grid - See Also:
-
setItems
- Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasListDataView<T,GridListDataView<T>>
-
getListDataView
Gets the list data view for the grid. This data view should only be used when the items are in-memory set with:HasListDataView.setItems(Collection)HasListDataView.setItems(Object[])setItems(ListDataProvider)
getLazyDataView()instead.- Specified by:
getListDataViewin interfacecom.vaadin.flow.data.provider.HasListDataView<T,GridListDataView<T>> - Returns:
- the list data view that provides access to the items in the grid
-
setItems
public GridLazyDataView<T> setItems(com.vaadin.flow.data.provider.BackEndDataProvider<T, Void> dataProvider) - Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasLazyDataView<T,Void, GridLazyDataView<T>>
-
setItemsPageable
public GridLazyDataView<T> setItemsPageable(Grid.SpringData.FetchCallback<org.springframework.data.domain.Pageable, T> fetchCallback) Supply items lazily with a callback from a backend based on a Spring Data Pageable. The component will automatically fetch more items and adjust its size until the backend runs out of items. Usage example:component.setItemsPageable(pageable -> orderService.getOrders(pageable));The returned data view object can be used for further configuration, or later on fetched with
getLazyDataView(). For using in-memory data, likeCollection, useHasListDataView.setItems(Collection)instead.- Parameters:
fetchCallback- a function that returns a sorted list of items from the backend based on the given pageable- Returns:
- a data view for further configuration
-
setItemsPageable
public GridLazyDataView<T> setItemsPageable(Grid.SpringData.FetchCallback<org.springframework.data.domain.Pageable, T> fetchCallback, Grid.SpringData.CountCallback<org.springframework.data.domain.Pageable> countCallback) Supply items lazily with callbacks: the first one fetches a list of items from a backend based on a Spring Data Pageable, the second provides the exact count of items in the backend. Use this in case getting the count is cheap and the user benefits from the component showing immediately the exact size. Usage example:component.setItemsPageable( pageable -> orderService.getOrders(pageable), pageable -> orderService.countOrders());The returned data view object can be used for further configuration, or later on fetched with
getLazyDataView(). For using in-memory data, likeCollection, useHasListDataView.setItems(Collection)instead.- Parameters:
fetchCallback- a function that returns a sorted list of items from the backend based on the given pageablecountCallback- a function that returns the number of items in the back end- Returns:
- LazyDataView instance for further configuration
-
getLazyDataView
Gets the lazy data view for the grid. This data view should only be used when the items are provided lazily from the backend with:HasLazyDataView.setItems(CallbackDataProvider.FetchCallback)HasLazyDataView.setItems(CallbackDataProvider.FetchCallback, CallbackDataProvider.CountCallback)setItems(BackEndDataProvider)
getListDataView()instead.- Specified by:
getLazyDataViewin interfacecom.vaadin.flow.data.provider.HasLazyDataView<T,Void, GridLazyDataView<T>> - Returns:
- the lazy data view that provides access to the data bound to the grid
-
getDataCommunicator
Returns the data communicator of this Grid.- Returns:
- the data communicator, not
null
-
getPageSize
public int getPageSize()Gets the current page size, which is the number of items fetched at a time from the dataprovider.- Returns:
- the current page size
-
setPageSize
public void setPageSize(int pageSize) Sets the page size, which is the number of items fetched at a time from the data provider. With the default value of50, the grid might fetch items for example as:0-49, 50-149, 150-200....Note: the number of items in the server-side memory can be considerably higher than the page size, since the component can show more than one page at a time.
Setting the pageSize after the Grid has been rendered effectively resets the component, and the current page(s) and sent over again.
With automatically extending grid, controlling the item count and how much it is increased when scrolling is possible via
getLazyDataView().- Parameters:
pageSize- the maximum number of items sent per request. Should be greater than zero
-
getSelectionModel
Returns the selection model for this grid.- Returns:
- the selection model, not null
-
setSelectionModel
Sets the selection model for the grid.This method is for setting a custom selection model, and is
protectedbecausesetSelectionMode(SelectionMode)should be used for easy switching between built-in selection models.The default selection model is
GridSingleSelectionModel.To use a custom selection model, you can e.g. extend the grid call this method with your custom selection model.
- Parameters:
model- the selection model to use, notnullselectionMode- the selection mode this selection model corresponds to, notnull- See Also:
-
updateSelectionModeOnClient
protected void updateSelectionModeOnClient() -
getSelectionMode
Returns the selection mode for this grid.- Returns:
- the selection mode, not null
-
setSelectionMode
Sets the grid's selection mode.To use your custom selection model, you can use
setSelectionModel(GridSelectionModel, SelectionMode), see existing selection model implementations for example.- Parameters:
selectionMode- the selection mode to switch to, notnull- Returns:
- the used selection model
- See Also:
-
setItemSelectableProvider
Sets a predicate to check whether a specific item in the grid may be selected or deselected by the user. The predicate receives an item instance and should returntrueif a user may change the selection state of that item, orfalseotherwise.This function does not prevent programmatic selection/deselection of items. Changing the function does not modify the currently selected items.
When using multi-selection, setting a provider will hide the select all checkbox.
- Parameters:
provider- the function to use to determine whether an item may be selected or deselected by the user, ornullto allow all items to be selected or deselected
-
asSingleSelect
Use this grid as a single select inBinder.Throws
IllegalStateExceptionif the grid is not using aGridSingleSelectionModel.- Returns:
- the single select wrapper that can be used in binder
- Throws:
IllegalStateException- if not using a single selection model
-
asMultiSelect
Use this grid as a multiselect inBinder.Throws
IllegalStateExceptionif the grid is not using aGridMultiSelectionModel.- Returns:
- the multiselect wrapper that can be used in binder
- Throws:
IllegalStateException- if not using a multiselection model
-
getSelectedItems
This method is a shorthand that delegates to the currently set selection model.- Returns:
- a set with the selected items, never
null - See Also:
-
select
This method is a shorthand that delegates to the currently set selection model.- Parameters:
item- the item to select, not null- See Also:
-
deselect
This method is a shorthand that delegates to the currently set selection model.- Parameters:
item- the item to deselect, not null- See Also:
-
deselectAll
public void deselectAll()This method is a shorthand that delegates to the currently set selection model.- See Also:
-
getSelectionPreservationMode
public com.vaadin.flow.component.shared.SelectionPreservationMode getSelectionPreservationMode()Gets the selection preservation mode.- Returns:
- the selection preservation mode
- See Also:
-
addSelectionListener
public com.vaadin.flow.shared.Registration addSelectionListener(com.vaadin.flow.data.selection.SelectionListener<Grid<T>, T> listener) Adds a selection listener to the current selection model.This is a shorthand for
grid.getSelectionModel().addSelectionListener(). To get more detailed selection events, usegetSelectionModel()and eitherGridSingleSelectionModel.addSingleSelectionListener(SingleSelectionListener)orGridMultiSelectionModel.addMultiSelectionListener(MultiSelectionListener)depending on the used selection mode.- Parameters:
listener- the listener to add- Returns:
- a registration handle to remove the listener
- Throws:
UnsupportedOperationException- if selection has been disabled withGrid.SelectionMode.NONE
-
setItemDetailsRenderer
Set the renderer to use for displaying the item details rows in this grid.- Parameters:
renderer- the renderer to use for displaying item details rows,nullto remove the current renderer
-
isColumnReorderingAllowed
@Synchronize("column-reordering-allowed-changed") public boolean isColumnReorderingAllowed()Returns whether column reordering is allowed. Default value isfalse.- Returns:
- true if reordering is allowed
-
setColumnReorderingAllowed
public void setColumnReorderingAllowed(boolean columnReorderingAllowed) Sets whether or not column reordering is allowed. Default value isfalse.- Parameters:
columnReorderingAllowed- specifies whether column reordering is allowed
-
getColumns
Gets an unmodifiable list of allGrid.Columns currently in thisGrid.Note: If column reordering is enabled with
setColumnReorderingAllowed(boolean)and the user has reordered the columns, the order of the list returned by this method might be incorrect.- Returns:
- unmodifiable list of columns
-
getColumnByKey
Gets aGrid.Columnof this grid by its key.- Parameters:
columnKey- the identifier key of the column to get- Returns:
- the column corresponding to the given column key, or
nullif no column has such key - See Also:
-
getColumnByInternalId
Gets aGrid.Columnof this grid by its internal id (_flowId). Intended only for internal use and can be removed in the future.- Parameters:
internalId- the internal identifier of the column to get- Returns:
- the column corresponding to the given column identifier, or
nullif no column has such an identifier
-
removeColumnByKey
Removes a column with the given column key from the Grid.- Parameters:
columnKey- the key of the column, assigned byGrid.Column.setKey(String), or automatically created when usingGrid(Class). Cannot benull- Throws:
IllegalArgumentException- if the column is not part of this Grid
-
removeColumn
Removes a column from the Grid.- Parameters:
column- the column to be removed, notnull- Throws:
NullPointerException- if the column isnullIllegalArgumentException- if the column is not owned by this Grid
-
removeColumns
Removes columns from the Grid. Does nothing if the array is empty.- Parameters:
columns- the columns to be removed, notnull- Throws:
NullPointerException- if the column isnullIllegalArgumentException- if the column is not owned by this Grid
-
removeAllColumns
public void removeAllColumns()Removes all columns from this Grid. -
setDetailsVisible
Sets the visibility of details component for given item.- Parameters:
item- the item to show details forvisible-trueif details component should be visible;falseif it should be hidden
-
setDetailsVisibleOnClick
public void setDetailsVisibleOnClick(boolean detailsVisibleOnClick) Sets whether the item details can be opened and closed by clicking the rows or not.- Parameters:
detailsVisibleOnClick-trueto enable opening and closing item details by clicking the rows,falseto disable this functionality- See Also:
-
isDetailsVisibleOnClick
public boolean isDetailsVisibleOnClick()Gets whether the item details are opened and closed by clicking the rows or not.- Returns:
trueif clicking the rows opens and closes their item details,falseotherwise- See Also:
-
isDetailsVisible
Returns the visibility of details component for given item.- Parameters:
item- the item to show details for- Returns:
trueif details component should be visible;falseif it should be hidden
-
addSortListener
public com.vaadin.flow.shared.Registration addSortListener(com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.data.event.SortEvent<Grid<T>, GridSortOrder<T>>> listener) - Specified by:
addSortListenerin interfacecom.vaadin.flow.data.event.SortEvent.SortNotifier<Grid<T>,GridSortOrder<T>>
-
setMultiSort
public void setMultiSort(boolean multiSort) Sets whether multiple column sorting is enabled on the client-side.- Parameters:
multiSort-trueto enable sorting of multiple columns on the client-side,falseto disable
-
setMultiSort
Sets whether multiple column sorting is enabled on the client-side.- Parameters:
multiSort-trueto enable sorting of multiple columns on the client-side,falseto disablepriority- the multi-sort priority to set, notnull- See Also:
-
setMultiSort
public void setMultiSort(boolean multiSort, boolean onShiftClickOnly) Sets whether multiple column sorting is enabled on the client-side.- Parameters:
multiSort-trueto enable sorting of multiple columns on the client-side,falseto disableonShiftClickOnly-trueto enable multi-sort by shift-clicking (whenmultiSort = true),falsefor normal multi-sort behavior
-
setMultiSort
public void setMultiSort(boolean multiSort, Grid.MultiSortPriority priority, boolean onShiftClickOnly) Sets whether multiple column sorting is enabled on the client-side.- Parameters:
multiSort-trueto enable sorting of multiple columns on the client-side,falseto disablepriority- the multi-sort priority to set, notnullonShiftClickOnly-trueto enable multi-sort by shift-clicking (whenmultiSort = true),falsefor normal multi-sort behavior- See Also:
-
isMultiSort
public boolean isMultiSort()Gets whether multiple column sorting is enabled on the client-side.- Returns:
trueif sorting of multiple columns is enabled,falseotherwise- See Also:
-
setAriaLabel
Set the aria-label of the component to the given text.- Parameters:
ariaLabel- the aria-label text to set ornullto clear
-
getAriaLabel
Gets the aria-label of the component.- Returns:
- an optional aria-label of the component if no aria-label has been set
-
addContextMenu
Adds a new context-menu for this grid.- Returns:
- the added context-menu
-
sort
Forces a defined sort order for the columns in the Grid. Settingnullor an empty list resets the ordering of all columns. Columns not mentioned in the list are reset to the unsorted state.For Grids with multi-sorting, the index of a given column inside the list defines the sort priority. For example, the column at index 0 of the list is sorted first, then on the index 1, and so on.
When Grid is not configured to have multi-sorting enabled, all the columns in the list except the first one are ignored.
- Parameters:
order- the list of sort orders to set on the client, ornullto reset any sort orders.- See Also:
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent) - Overrides:
onDetachin classcom.vaadin.flow.component.Component
-
getSortOrder
Gets an list of the current sort orders in the Grid.- Returns:
- an unmodifiable list of sort orders
-
createSortingComparator
Creates a comparator for grid to sort rows.- Returns:
- the comparator based on column sorting information.
-
setAllRowsVisible
public void setAllRowsVisible(boolean allRowsVisible) Iftrue, the grid's height is defined by its rows. All items are fetched from theDataProvider, and the Grid shows no vertical scroll bar.Note:
setAllRowsVisibledisables the grid's virtual scrolling so that all the rows are rendered in the DOM at once. If the grid has a large number of items, using the feature is discouraged to avoid performance issues.- Parameters:
allRowsVisible-trueto make Grid compute its height by the number of rows,falsefor the default behavior
-
isAllRowsVisible
@Synchronize("all-rows-visible-changed") public boolean isAllRowsVisible()Gets whether grid's height is defined by the number of its rows.- Returns:
trueif Grid computes its height by the number of rows,falseotherwise
-
onEnabledStateChanged
public void onEnabledStateChanged(boolean enabled) - Overrides:
onEnabledStateChangedin classcom.vaadin.flow.component.Component
-
addValueProvider
public com.vaadin.flow.shared.Registration addValueProvider(String property, com.vaadin.flow.function.ValueProvider<T, ?> valueProvider) Adds a ValueProvider to this Grid that is not tied to a Column. This is specially useful when the columns are defined via a template file instead of the Java API.The properties added to by this method are global to the Grid - they can be used in any column.
ValueProviders are registered as
DataGenerators in the Grid. SeeaddDataGenerator(DataGenerator).- Parameters:
property- the property name used in the template. For example, in a template the uses[[item.name]], the property isname. NotnullvalueProvider- the provider for values for the property, notnull- Returns:
- a registration that can be used to remove the ValueProvider from the Grid
-
addDataGenerator
public com.vaadin.flow.shared.Registration addDataGenerator(com.vaadin.flow.data.provider.DataGenerator<T> dataGenerator) - Specified by:
addDataGeneratorin interfacecom.vaadin.flow.data.provider.HasDataGenerators<T>
-
compareMaybeComparables
-
configureBeanType
Sets the bean type this grid is bound to and optionally adds a set of columns for each of the bean's properties. The property-values of the bean will be converted to Strings. Full names of the properties will be used as thecolumn keysand the property captions will be used as thecolumn headers. The generated columns will be sortable by default, if the property isComparable.When autoCreateColumns is
true, only the direct properties of the bean are included and they will be in alphabetical order. UsesetColumns(String...)to define which properties to include and in which order. You can also add a column for an individual property withaddColumn(String). Both of these methods support also sub-properties with dot-notation, eg."property.nestedProperty".This method can only be called for a newly instanced Grid without any beanType or columns set.
- Parameters:
beanType- the bean type to use, notnullautoCreateColumns- whentrue, columns are created automatically for the properties of the beanType
-
getBeanType
Returns the Class of bean this Grid is constructed with viaGrid(Class). Or null if not constructed from a bean type.- Returns:
- the Class of bean this Grid is constructed with
-
getPropertySet
ReturnsPropertySetof bean this Grid is constructed with viaGrid(Class). Or null if not constructed from a bean type.- Returns:
- the
PropertySetof bean this Grid is constructed with
-
addItemClickListener
public com.vaadin.flow.shared.Registration addItemClickListener(com.vaadin.flow.component.ComponentEventListener<ItemClickEvent<T>> listener) Adds an item click listener to this component.- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
- See Also:
-
addColumnResizeListener
public com.vaadin.flow.shared.Registration addColumnResizeListener(com.vaadin.flow.component.ComponentEventListener<ColumnResizeEvent<T>> listener) Adds a column resize listener to this component. Note that the listener will be notified only for user-initiated column resize actions.- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
-
addItemDoubleClickListener
public com.vaadin.flow.shared.Registration addItemDoubleClickListener(com.vaadin.flow.component.ComponentEventListener<ItemDoubleClickEvent<T>> listener) Adds an item double click listener to this component.Note that double click event happens along with a click event. It means there is no way to get a double click event only (double click without a click): a click listener added using
addItemClickListener(ComponentEventListener)(if any) will also be notified about a click event once a double click event is fired.Double click event type is not fully supported by the mobile browsers which means that double click event might not work (double click listeners won't be notified) for such browsers.
- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
- See Also:
-
addCellFocusListener
public com.vaadin.flow.shared.Registration addCellFocusListener(com.vaadin.flow.component.ComponentEventListener<CellFocusEvent<T>> listener) Adds a listener to the grid that will be notified, when a cell has been focused.
The listener will be notified, when- the navigation focus of a cell gets activated
- the focus is restored to the browser if a cell had navigation focus before the focus was lost
- the navigation focus moves between header/body/footer sections
The listener will not be notified, when- the focus changes between focusable elements in the Grid cells ("interaction mode")
- on Grid Pro edit mode navigation ("interaction mode")
- the focus changes between focusable elements in the cells in Flow Grid's editor mode ("interaction mode")
- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
-
getEditor
Gets the editor.The editor is created using
createEditor().- Returns:
- the editor instance
- See Also:
-
setClassNameGenerator
@Deprecated public void setClassNameGenerator(com.vaadin.flow.function.SerializableFunction<T, String> classNameGenerator) Deprecated.setPartNameGenerator(com.vaadin.flow.function.SerializableFunction<T, java.lang.String>)should be used instead.Sets the function that is used for generating CSS class names for all the cells in the rows in this grid. Returningnullfrom the generator results in no custom class name being set. Multiple class names can be returned from the generator as space-separated.If
Grid.Column.setClassNameGenerator(SerializableFunction)is used together with this method, resulting class names from both methods will be effective. Class names generated by grid are applied to the cells before the class names generated by column. This means that if the classes contain conflicting style properties, column's classes will win.- Parameters:
classNameGenerator- the class name generator to set, notnull- Throws:
NullPointerException- ifclassNameGeneratorisnull- See Also:
-
setPartNameGenerator
public void setPartNameGenerator(com.vaadin.flow.function.SerializableFunction<T, String> partNameGenerator) Sets the function that is used for generating CSS part names for all the cells in the rows in this grid. Returningnullfrom the generator results in no custom part name being set. Multiple part names can be returned from the generator as space-separated.If
Grid.Column.setPartNameGenerator(SerializableFunction)is used together with this method, resulting part names from both methods will be effective.- Parameters:
partNameGenerator- the part name generator to set, notnull- Throws:
NullPointerException- ifpartNameGeneratorisnull- See Also:
-
recalculateColumnWidths
public void recalculateColumnWidths()Updates thewidthof all columns which haveautoWidthset totrue.- See Also:
-
getClassNameGenerator
Gets the function that is used for generating CSS class names for rows in this grid.- Returns:
- the class name generator
-
getPartNameGenerator
Gets the function that is used for generating CSS part names for rows in this grid.- Returns:
- the part name generator
-
generatePartData
-
generateSelectableData
-
createEditor
Creates a new Editor instance. Can be overridden to create a custom Editor. If the Editor is aGrid.AbstractGridExtension, it will be automatically added toDataCommunicator.- Returns:
- editor
-
getUniqueKeyProvider
Gets optional value provider for unique key in row's generated JSON.- Returns:
- ValueProvider for unique key for row or null if not set
-
setUniqueKeyProvider
protected void setUniqueKeyProvider(com.vaadin.flow.function.ValueProvider<T, String> uniqueKeyProvider) Sets value provider for unique key in row's generated JSON.nullby default.- Parameters:
uniqueKeyProvider- ValueProvider for unique key for row
-
getUniqueKeyProperty
Gets property name for unique key in row's generated JSON.- Returns:
- the optional property name for unique key
-
setUniqueKeyProperty
Sets property name for unique key in row's generated JSON.- Parameters:
uniqueKeyProperty- the new optional property name for unique key
-
getArrayUpdater
-
onDataProviderChange
protected void onDataProviderChange()Callback which is called if a new data provider is set or any change happen in the current data provider (anDataChangeEventevent is fired). Default implementation closes the editor if it's opened.- See Also:
-
DataChangeEventDataProviderListener
-
addDropListener
public com.vaadin.flow.shared.Registration addDropListener(com.vaadin.flow.component.ComponentEventListener<GridDropEvent<T>> listener) Adds a drop listener to this component.- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
-
addDragStartListener
public com.vaadin.flow.shared.Registration addDragStartListener(com.vaadin.flow.component.ComponentEventListener<GridDragStartEvent<T>> listener) Adds a drag start listener to this component.- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
-
addDragEndListener
public com.vaadin.flow.shared.Registration addDragEndListener(com.vaadin.flow.component.ComponentEventListener<GridDragEndEvent<T>> listener) Adds a drag end listener to this component.- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
-
setDropMode
Sets the drop mode of this drop target. When set to notnull, grid fires drop events upon data drop over the grid or the grid rows.When using
GridDropMode.ON_TOP, and the grid is either empty or has empty space after the last row, the drop can still happen on the empty space, and theGridDropEvent.getDropTargetItem()will return an empty optional.When using
GridDropMode.BETWEENorGridDropMode.ON_TOP_OR_BETWEEN, and there is at least one row in the grid, any drop after the last row in the grid will get the last row as theGridDropEvent.getDropTargetItem(). If there are no rows in the grid, then it will return an empty optional.If using
GridDropMode.ON_GRID, then the drop will not happen on any row, but instead just "on the grid". The target row will not be present in this case.NOTE: Prefer not using a row specific
GridDropModewith a grid that enables sorting. If for example a new row gets added to a specific location on drop event, it might not end up in the location of the drop but rather where the active sorting configuration prefers to place it. This behavior might feel unexpected for the users.- Parameters:
dropMode- Drop mode that describes the allowed drop locations within the Grid's row. Can benullto disable dropping on the grid.- See Also:
-
getDropMode
Gets the drop mode of this drop target.- Returns:
- Drop mode that describes the allowed drop locations within the
Grid's row.
nullif dropping is not enabled.
-
setRowsDraggable
public void setRowsDraggable(boolean rowsDraggable) Sets whether the user can drag the grid rows or not.- Parameters:
rowsDraggable-trueif the rows can be dragged by the user;falseif not
-
isRowsDraggable
public boolean isRowsDraggable()Gets whether rows of the grid can be dragged.- Returns:
trueif the rows are draggable,falseotherwise
-
getDropFilter
Gets the active drop filter.- Returns:
- The drop filter function
-
getDragFilter
Gets the active drag filter.- Returns:
- The drag filter function
-
setDropFilter
Sets the drop filter for this drag target.When the drop mode of the grid has been set to one of
GridDropMode.BETWEEN,GridDropMode.ON_TOPorGridDropMode.ON_TOP_OR_BETWEEN, by default all the visible rows can be dropped over.A drop filter function can be used to specify the rows that are available for dropping over. The function receives an item and should return
trueif the row can be dropped over,falseotherwise.NOTE: If the filter conditions depend on a specific row that's currently being dragged, you might want to have the grid's drop mode disabled by default and set its value only on drag start to avoid the small period of time during which the user might be able to drop over unwanted rows. Once the drop end event occurs, the drop mode can be set back to
nullto keep this consistent.NOTE: If the filtering conditions change dynamically, remember to explicitly invoke
getDataProvider().refreshItem(item)for the relevant items to get the filters re-run for them. -
setDragFilter
Sets the drag filter for this drag source.When the
setRowsDraggable(boolean)has been used to enable dragging, by default all the visible rows can be dragged.A drag filter function can be used to specify the rows that are available for dragging. The function receives an item and returns
trueif the row can be dragged,falseotherwise.NOTE: If the filtering conditions change dynamically, remember to explicitly invoke
getDataProvider().refreshItem(item)for the relevant items to get the filters re-run for them. -
setDragDataGenerator
public void setDragDataGenerator(String type, com.vaadin.flow.function.SerializableFunction<T, String> dragDataGenerator) Sets a generator function for customizing drag data. The generated value will be accessible using the sametypeas the generator is set here. The function is executed for each item in the Grid during data generation. Return aStringto be appended to the row astypedata.Note that IE11 only supports data type "text"
- Parameters:
type- Type of the generated data. The generated value will be accessible during drop using this type.dragDataGenerator- Function to be executed on row data generation.
-
setTooltipGenerator
public void setTooltipGenerator(com.vaadin.flow.function.SerializableFunction<T, String> tooltipGenerator) Sets the function that is used for generating tooltip text for all cells in this grid. Tooltip generators set to individual columns have priority over the generator set with this method. Returningnullfrom the generator results in no tooltip being set.- Parameters:
tooltipGenerator- the tooltip generator to set, notnull- Throws:
NullPointerException- iftooltipGeneratorisnull- Since:
- 24.1
-
getTooltipPosition
public com.vaadin.flow.component.shared.Tooltip.TooltipPosition getTooltipPosition()Gets the tooltip position relative to the cell that is being hovered or focused. The default position isTooltip.TooltipPosition.BOTTOM.- Returns:
- the position of the tooltip
-
setSelectionDragDetails
Sets explicit drag operation details for when the user is dragging the selected items. By default, the drag data only covers the items in the visible viewport and all the items outside of it, even if selected, are excluded. Use this method to override the default drag data and the number shown in drag image on selection drag.Note that IE11 only supports data type "text"
- Parameters:
draggedItemsCount- The number shown in the drag image on selection drag. Only values above 1 have any visible effect.dragData- The drag data for selection drag. The map should consist of data type:data -entries
-
addColumnReorderListener
public com.vaadin.flow.shared.Registration addColumnReorderListener(com.vaadin.flow.component.ComponentEventListener<ColumnReorderEvent<T>> listener) Adds a column reorder listener to this component.- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
-
setColumnOrder
Sets a new column order for the grid.The function doesn't support column removal: all columns must be present in the list, otherwise
IllegalArgumentExceptionis thrown.The
getColumns()function will reflect the new column ordering.Fires the
ColumnReorderEventwithComponentEvent.isFromClient()returningfalse.The method is atomic: if the requested reordering is not achievable, the function fails cleanly with
IllegalArgumentExceptionwithout doing any work.- Parameters:
columns- the new ordering of the columns, notnull.- Throws:
NullPointerException- if thecolumnsparameter isnull.IllegalArgumentException- if a column is present two times in the list, or if the column is not owned by this Grid, or if the list doesn't contain all columns currently present in the Grid, or if the column rearranging would require to split a joined header/footer cell group.- See Also:
-
setColumnOrder
Sets a new column order for the grid.The function doesn't support column removal: all columns must be present in the list, otherwise
IllegalArgumentExceptionis thrown.The
getColumns()function will reflect the new column ordering.Fires the
ColumnReorderEventwithComponentEvent.isFromClient()returningfalse.The method is atomic: if the requested reordering is not achievable, the function fails cleanly with
IllegalArgumentExceptionwithout doing any work.- Parameters:
columns- the new ordering of the columns, notnull.- Throws:
NullPointerException- if thecolumnsparameter isnull.IllegalArgumentException- if a column is present two times in the list, or if the column is not owned by this Grid, or if the list doesn't contain all columns currently present in the Grid, or if the column rearranging would require to split a joined header/footer cell group.- See Also:
-
scrollToIndex
public void scrollToIndex(int rowIndex) Scrolls to the given row index. Scrolls so that the row is shown at the start of the visible area whenever possible. If the index parameter exceeds current item set size the grid will scroll to the end.- Parameters:
rowIndex- zero based index of the item to scroll to in the current view.
-
scrollToItem
Scrolls to the row presenting the given item.Note that the item index provider should be explicitly set using
AbstractLazyDataView.setItemIndexProvider(ItemIndexProvider)for lazy loading data providers. Otherwise, anUnsupportedOperationExceptionwill be thrown.- Parameters:
item- the item to scroll to, notnull.- Throws:
NullPointerException- if theitemparameter isnull.NoSuchElementException- if theitemcannot be found.UnsupportedOperationException- ifItemIndexProvideris missing for grid with a lazy loading data provider.
-
scrollToStart
public void scrollToStart()Scrolls to the beginning of the first data row. -
scrollToEnd
public void scrollToEnd()Scrolls to the last data row of the grid. -
setNestedNullBehavior
Set the behavior when facing nestednullvalues. By default the value isNestedNullBehavior.THROW.- Parameters:
nestedNullBehavior- the behavior when facing nestednullvalues.
-
getNestedNullBehavior
Get the behavior when facing nestednullvalues.- Returns:
- The current behavior when facing nested
nullvalues.
-
setColumnRendering
Sets the mode for rendering columns in the grid.eager (default): All columns are rendered upfront, regardless of their visibility within the viewport. This mode should generally be preferred, as it avoids the limitations imposed by the "lazy" mode. Use this mode unless the grid has a large number of columns and performance outweighs the limitations in priority.
lazy: Optimizes the rendering of cells when there are multiple columns in the grid by virtualizing horizontal scrolling. In this mode, body cells are rendered only when their corresponding columns are inside the visible viewport.
Using "lazy" rendering should be used only if you're dealing with a large number of columns and performance is your highest priority. For most use cases, the default "eager" mode is recommended due to the limitations imposed by the "lazy" mode.
When using the "lazy" mode, keep the following limitations in mind:
- Row Height: When only a number of columns are visible at once, the height of a row can only be that of the highest cell currently visible on that row. Make sure each cell on a single row has the same height as all other cells on that row. If row cells have different heights, users may experience jumpiness when scrolling the grid horizontally as lazily rendered cells with different heights are scrolled into view.
- Auto-width Columns: For the columns that are initially outside the visible viewport but still use auto-width, only the header content is taken into account when calculating the column width because the body cells of the columns outside the viewport are not initially rendered.
- Screen Reader Compatibility: Screen readers may not be able to associate the focused cells with the correct headers when only a subset of the body cells on a row is rendered.
- Keyboard Navigation: Tabbing through focusable elements inside the grid body may not work as expected because some of the columns that would include focusable elements in the body cells may be outside the visible viewport and thus not rendered.
- Parameters:
columnRendering- the column rendering mode to use- See Also:
-
getColumnRendering
Gets the current column rendering mode.- Returns:
- the current column rendering mode
-
setEmptyStateComponent
public void setEmptyStateComponent(com.vaadin.flow.component.Component emptyStateComponent) Sets the component to be displayed when the grid is empty.Note: This will also override any empty state content set with
setEmptyStateText(String).- Parameters:
emptyStateComponent- the component to be displayed when the grid is empty, or null to clear the empty state content
-
setEmptyStateText
Sets the text to be displayed when the grid is empty.Note: This will also override any empty state content set with
setEmptyStateComponent(Component).- Parameters:
emptyStateText- the text to be displayed when the grid is empty, or null to clear the empty state content
-
getEmptyStateComponent
public com.vaadin.flow.component.Component getEmptyStateComponent()Returns the component that is displayed when the grid is empty.- Returns:
- the component that is displayed when the grid is empty or null if no empty state component is set
-
getEmptyStateText
Returns the text that is displayed when the grid is empty.- Returns:
- the text that is displayed when the grid is empty or null if no empty state text is set
-
createDetailsManager
-