Package io.jmix.ui.component
Interface DataGrid<E>
- Type Parameters:
E
- row item type
- All Superinterfaces:
ActionsHolder
,Component
,Component.BelongToFrame
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,HasButtonsPanel
,HasContextHelp
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,HasMinSize
,HasPagination
,HasSubParts
,ListComponent<E>
,LookupComponent<E>
- All Known Subinterfaces:
TreeDataGrid<E>
- All Known Implementing Classes:
AbstractDataGrid
,DataGridImpl
,TreeDataGridImpl
@StudioComponent(caption="DataGrid",
category="Components",
xmlElement="dataGrid",
icon="io/jmix/ui/icon/component/dataGrid.svg",
canvasBehaviour=TABLE,
documentationURL="https://docs.jmix.io/jmix/%VERSION%/ui/vcl/components/data-grid.html")
public interface DataGrid<E>
extends ListComponent<E>, HasButtonsPanel, Component.HasCaption, Component.HasIcon, HasContextHelp, HasHtmlCaption, HasHtmlDescription, LookupComponent<E>, Component.Focusable, HasSubParts, HasHtmlSanitizer, HasPagination, HasMinSize
A grid component for displaying tabular data bound to entity type.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
The root class from which all DataGrid editor event state objects shall be derived.static class
The root class from which all DataGrid event state objects shall be derived.static enum
Defines the position of aggregation row.static interface
A Renderer that displays a button with a textual caption.static interface
A renderer that represents a boolean values as a graphical check box icons.static interface
A renderer for presenting simple plain-text string values as a link with call back handler.static interface
A column in the DataGrid.static class
An event that is fired when a column's collapsing changes.static class
Event provided by a column generatorstatic class
An event that is fired when the columns are reordered.static class
An event that is fired when a column is resized.static enum
static interface
A renderer for UI components.static class
Context click event fired by aDataGrid
.static class
Class for holding information about a mouse click event.static enum
Enumeration, specifying the content type of a Cell in a DataGrid header or footer.static interface
A renderer for presenting date values.static class
An event that is fired when the DataGrid editor is closed.static class
class which stores information that can be used when creating a component for aDataGrid
editor.static class
An event that is fired before the DataGrid editor is opened.static class
An event that is fired after the item is updated.static class
An event that is fired before the item is updated.static class
Describes empty state link click event.static interface
Represents a footer cell in DataGrid.static interface
Represents a footer row in DataGrid.static interface
A renderer has a DateTimeFormatter.static interface
A renderer has a format string.static interface
A renderer has a locale.static interface
A renderer has a null representation.static interface
Renderer has click listener.static interface
Represents a header cell in DataGrid.static interface
Represents a header row in DataGrid.static interface
A renderer for presenting HTML content.static interface
A renderer that representsJmixIcon
.static interface
A renderer for presenting images.static class
Click event fired by aDataGrid
static interface
A renderer for presenting LocalDate values.static interface
A renderer for presenting LocalDateTime values.static interface
A renderer for presenting number values.static interface
A renderer that represents a double values as a graphical progress bar.static interface
Marker interface to indicate that the implementing class can be used as a renderer.static class
Click event fired by aDataGrid.HasRendererClickListener
static enum
Enumeration, specifying the destinations that are supported when scrolling rows or columns into view.static class
Event sent when the selection changes.static enum
static enum
Describes sorting direction.static class
An event that is fired when a sort order is changed.static class
Sort order descriptor.static interface
Base interface for DataGrid header or footer cells.static interface
DataGrid.StaticRow<T extends DataGrid.StaticCell>
Base interface for DataGrid header and footer rows.static interface
A renderer for presenting simple plain-text string values.Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.LookupComponent
LookupComponent.LookupSelectionChangeEvent<T>, LookupComponent.LookupSelectionChangeNotifier<T>
-
Field Summary
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumn
(DataGrid.Column<E> column) Adds the given column to DataGrid.void
addColumn
(DataGrid.Column<E> column, int index) Adds the given column at the specified index to DataGrid.addColumn
(String id, MetaPropertyPath propertyPath) Creates new column with given Id and property, then adds this column to DataGrid.addColumn
(String id, MetaPropertyPath propertyPath, int index) Creates new column with given Id and property at the specified index, then adds this column to DataGrid.Registers a new column collapsing change listener.Registers a new column reorder listener.Registers a new column resize listener.Registers a new context click listeneraddEditorCloseListener
(Consumer<DataGrid.EditorCloseEvent<E>> listener) Registers a new DataGrid editor close listener.addEditorOpenListener
(Consumer<DataGrid.EditorOpenEvent<E>> listener) Registers a new DataGrid editor open listener.Registers a new DataGrid editor post commit listener.Registers a new DataGrid editor pre commit listener.addFooterRowAt
(int index) Inserts a new row at the given position to the footer section.addGeneratedColumn
(String columnId, Function<DataGrid.ColumnGeneratorEvent<E>, ?> generator) Add a generated column to the DataGrid.addGeneratedColumn
(String columnId, Function<DataGrid.ColumnGeneratorEvent<E>, ?> generator, int index) Add a generated column to the DataGrid.addHeaderRowAt
(int index) Inserts a new row at the given position to the header section.addItemClickListener
(Consumer<DataGrid.ItemClickEvent<E>> listener) Registers a new item click listenervoid
addRowStyleProvider
(Function<? super E, String> styleProvider) Adds style provider for the DataGrid rows.addSelectionListener
(Consumer<DataGrid.SelectionEvent<E>> listener) Registers a new selection listeneraddSortListener
(Consumer<DataGrid.SortEvent> listener) Registers a new sort order change listenerAdds a new row at the bottom of the footer section.Adds a new row at the bottom of the header section.void
Closes editor if it's opened.void
Deselects the given item.void
Deselects all the items in the current data source.void
Opens the editor interface for the provided entity.double
Returns the current body row height.Returns a column based on the Id.getColumnGenerator
(String columnId) Gets the columns generator for the given column id.getColumnNN
(String id) Returns a column by its Id.Returns the current column resize mode.Returns a copy of currently configured columns in their current visual order in this DataGrid.Returns the current default row of the header section.Returns the item that is currently being edited.Gets the current caption of the cancel button in the DataGrid editor.Gets the current caption of the save button in the DataGrid editor.getFooterRow
(int index) Gets the footer row at given index.int
Gets the row count for the footer.double
Returns the current footer row height.int
Gets the number of frozen columns in this DataGrid.getHeaderRow
(int index) Gets the header row at given index.int
Gets the row count for the header section.double
Returns the current header row height.getItems()
Returns theRowDescriptionProvider
instance used to generate descriptions (tooltips) for DataGrid rowsdefault Object
getSubPart
(String name) Returns a copy of columns not hidden by security permissions.boolean
boolean
Returns whether column reordering is allowed.boolean
boolean
boolean
isDetailsVisible
(E entity) Checks whether details are visible for the given item.boolean
Returns whether an item is currently being edited in the editor.boolean
Gets the buffered editor mode.boolean
boolean
Checks whether the item editor UI is enabled for this DataGrid.boolean
Returns the visibility of the footer section.boolean
Returns the visibility of the header section.boolean
boolean
static <T> org.springframework.core.ParameterizedTypeReference<DataGrid<T>>
Adds a new row at the top of the footer section.Adds a new row at the top of the header section.void
removeColumn
(DataGrid.Column<E> column) Removes the given column from DataGrid or do nothing if column isnull
.void
removeColumn
(String id) Removes a column from DataGrid by its Id or do nothing if column is not found.void
removeFooterRow
(int index) Removes the row at the given position from the footer section.void
removeFooterRow
(DataGrid.FooterRow footerRow) Removes the given row from the footer section.void
removeHeaderRow
(int index) Removes the row at the given position from the header section.void
removeHeaderRow
(DataGrid.HeaderRow headerRow) Removes the given row from the header section.void
removeRowStyleProvider
(Function<? super E, String> styleProvider) Removes style provider for the DataGrid rows.void
repaint()
Repaint UI representation of the DataGrid without refreshing the table data.void
Scrolls to a certain item, usingDataGrid.ScrollDestination.ANY
.void
scrollTo
(E item, DataGrid.ScrollDestination destination) Scrolls to a certain item, using user-specified scroll destination.void
Scrolls to the last data item.void
Scrolls to the first data item.void
Marks all the items in the current data source as selected.void
setAggregatable
(boolean aggregatable) Set to true if aggregation should be enabled.void
Sets aggregation row position.void
setBodyRowHeight
(double rowHeight) Sets the height of a body row.void
setColumnReorderingAllowed
(boolean columnReorderingAllowed) Sets whether or not column reordering is allowed.void
Sets the column resize mode to use.void
setColumnsCollapsingAllowed
(boolean columnsCollapsingAllowed) Defines if collapsible attribute can be changed for individual column or not.void
setContextMenuEnabled
(boolean contextMenuEnabled) Sets whether or not context menu is enabled.void
setDefaultHeaderRow
(DataGrid.HeaderRow headerRow) Sets the default row of the header.void
setDetailsGenerator
(Function<E, Component> detailsGenerator) Sets a new details generator for row details.void
setDetailsVisible
(E entity, boolean visible) Shows or hides the details for a specific item.void
setEditorBuffered
(boolean editorBuffered) Sets the buffered editor mode.void
setEditorCancelCaption
(String cancelCaption) Sets the caption on the cancel button in the DataGrid editor.void
setEditorCrossFieldValidate
(boolean validate) Enables cross field validation in the inline editor.void
setEditorEnabled
(boolean isEnabled) Sets whether or not the item editor UI is enabled for this DataGrid.void
setEditorSaveCaption
(String saveCaption) Sets the caption on the save button in the DataGrid editor.void
Sets click handler for link message.void
setEmptyStateLinkMessage
(String linkMessage) Sets a link message to the middle of DataGrid body that should be appeared when DataGrid is empty.void
setEmptyStateMessage
(String message) Sets a message to the middle of DataGrid body that should be appeared when DataGrid is empty.void
setEnterPressAction
(Action action) Assigns an action to be executed on Enter key press.void
setFooterRowHeight
(double rowHeight) Sets the body of a footer row.void
setFooterVisible
(boolean footerVisible) Sets the visibility of the footer section.void
setFrozenColumnCount
(int numberOfColumns) Sets the number of frozen columns in this grid.void
setHeaderRowHeight
(double rowHeight) Sets the body of a body row.void
setHeaderVisible
(boolean headerVisible) Sets the visibility of the header section.void
setItemClickAction
(Action action) Assigns an action to be executed on double click on a DataGrid row.void
setItems
(DataGridItems<E> dataGridItems) Sets an instance ofDataGridItems
as the DataGrid data source.void
setMinHeight
(String minHeight) SetsminHeight
CSS property value to the Grid (not a composition).void
setMinWidth
(String minWidth) SetsminWidth
CSS property value to the Grid (not a composition).void
setRowDescriptionProvider
(Function<? super E, String> provider) Sets theRowDescriptionProvider
instance for generating optional descriptions (tooltips) for DataGrid rows.void
setRowDescriptionProvider
(Function<? super E, String> provider, ContentMode contentMode) Sets theRowDescriptionProvider
instance for generating optional descriptions (tooltips) for DataGrid rows.void
setSelectionMode
(DataGrid.SelectionMode selectionMode) Sets the DataGrid's selection mode.void
setSortable
(boolean sortable) Defines if this attribute can be changed for individual column or not.void
setTextSelectionEnabled
(boolean textSelectionEnabled) Enable or disable text selection in DataGrid cells.void
sort
(String columnId, DataGrid.SortDirection direction) Sorts the DataGrid data for passed column id in the chosen sort direction.Methods inherited from interface io.jmix.ui.component.ActionsHolder
addAction, addAction, getAction, getActionNN, getActions, removeAction, removeAction, removeAllActions
Methods inherited from interface io.jmix.ui.component.Component
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.Focusable
focus, getTabIndex, isFocusable, setFocusable, setTabIndex
Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIcon, setIconFromSet
Methods inherited from interface io.jmix.ui.component.HasButtonsPanel
getButtonsPanel, setButtonsPanel
Methods inherited from interface io.jmix.ui.component.HasContextHelp
getContextHelpIconClickHandler, getContextHelpText, isContextHelpTextHtmlEnabled, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled
Methods inherited from interface io.jmix.ui.component.HasHtmlCaption
isCaptionAsHtml, setCaptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
Methods inherited from interface io.jmix.ui.component.HasPagination
getPagination, setPagination
Methods inherited from interface io.jmix.ui.component.ListComponent
getSelected, getSingleSelected, isMultiSelect, setSelected, setSelected
Methods inherited from interface io.jmix.ui.component.LookupComponent
getLookupSelectedItems, setLookupSelectHandler
-
Field Details
-
NAME
- See Also:
-
-
Method Details
-
of
-
getColumns
@StudioElementsGroup(xmlElement="columns", caption="Columns", icon="io/jmix/ui/icon/element/columns.svg") List<DataGrid.Column<E>> getColumns()Returns a copy of currently configured columns in their current visual order in this DataGrid.- Returns:
- unmodifiable copy of current columns
- See Also:
-
getVisibleColumns
List<DataGrid.Column<E>> getVisibleColumns()Returns a copy of columns not hidden by security permissions.- Returns:
- copy of columns not hidden by security permissions
- See Also:
-
getColumn
Returns a column based on the Id.- Parameters:
id
- the column Id- Returns:
- the column or
null
if not found - See Also:
-
getColumnNN
Returns a column by its Id.- Parameters:
id
- the column Id- Returns:
- the column with given Id
- Throws:
IllegalStateException
- if not found- See Also:
-
addColumn
Adds the given column to DataGrid.- Parameters:
column
- the column to add- See Also:
-
addColumn
Adds the given column at the specified index to DataGrid.- Parameters:
column
- the column to addindex
- index of a new column- See Also:
-
addColumn
Creates new column with given Id and property, then adds this column to DataGrid.- Parameters:
id
- the column IdpropertyPath
- the instance ofMetaPropertyPath
representing a relative path to a property from certain MetaClass- Returns:
- the newly created column
- See Also:
-
addColumn
Creates new column with given Id and property at the specified index, then adds this column to DataGrid.- Parameters:
id
- the column IdpropertyPath
- the instance ofMetaPropertyPath
representing a relative path to a property from certain MetaClassindex
- index of a new column- Returns:
- the newly created column
- See Also:
-
removeColumn
Removes the given column from DataGrid or do nothing if column isnull
.- Parameters:
column
- the column to add- See Also:
-
removeColumn
Removes a column from DataGrid by its Id or do nothing if column is not found.- Parameters:
id
- the columns Id- See Also:
-
getItems
- Specified by:
getItems
in interfaceListComponent<E>
- Returns:
- The DataGrid source
-
setItems
Sets an instance ofDataGridItems
as the DataGrid data source.- Parameters:
dataGridItems
- the DataGrid data source
-
selectAll
void selectAll()Marks all the items in the current data source as selected. -
deselect
Deselects the given item. If the item is not currently selected, does nothing.- Parameters:
item
- the item to deselect, not null
-
deselectAll
void deselectAll()Deselects all the items in the current data source. -
sort
Sorts the DataGrid data for passed column id in the chosen sort direction.- Parameters:
columnId
- id of the column to sortdirection
- sort direction
-
getSortOrder
List<DataGrid.SortOrder> getSortOrder()- Returns:
- sort order list
-
isTextSelectionEnabled
boolean isTextSelectionEnabled()- Returns:
true
if text selection is enabled.
-
setTextSelectionEnabled
Enable or disable text selection in DataGrid cells. Default value isfalse
.- Parameters:
textSelectionEnabled
- specifies whether text selection in DataGrid cells is enabled
-
isColumnReorderingAllowed
boolean isColumnReorderingAllowed()Returns whether column reordering is allowed. Default value istrue
.- Returns:
true
if reordering is allowed
-
setColumnReorderingAllowed
@StudioProperty(name="reorderingAllowed", defaultValue="true") void setColumnReorderingAllowed(boolean columnReorderingAllowed) Sets whether or not column reordering is allowed. Default value istrue
.- Parameters:
columnReorderingAllowed
- specifies whether column reordering is allowed
-
isHeaderVisible
boolean isHeaderVisible()Returns the visibility of the header section.- Returns:
true
if visible,false
otherwise
-
setHeaderVisible
Sets the visibility of the header section.- Parameters:
headerVisible
-true
to show the header section,false
to hide
-
getBodyRowHeight
double getBodyRowHeight()Returns the current body row height.- Returns:
- body row height, -1 if height is AUTO
-
setBodyRowHeight
@StudioProperty(name="bodyRowHeight", defaultValue="-1.0") @Min(-1L) void setBodyRowHeight(double rowHeight) Sets the height of a body row. If -1 (default), the row height is calculated based on the theme for an empty row before the DataGrid is displayed.- Parameters:
rowHeight
- the height of a row in pixels or -1 for AUTO
-
getHeaderRowHeight
double getHeaderRowHeight()Returns the current header row height.- Returns:
- header row height, -1 if height is AUTO
-
setHeaderRowHeight
@StudioProperty(name="headerRowHeight", defaultValue="-1.0") @Min(-1L) void setHeaderRowHeight(double rowHeight) Sets the body of a body row. If -1 (default), the row height is calculated based on the theme for an empty row before the DataGrid is displayed.- Parameters:
rowHeight
- the height of a row in pixels or -1 for AUTO
-
isContextMenuEnabled
boolean isContextMenuEnabled()- Returns:
true
if context menu is enabled,false
otherwise
-
setContextMenuEnabled
void setContextMenuEnabled(boolean contextMenuEnabled) Sets whether or not context menu is enabled. Default value istrue
.- Parameters:
contextMenuEnabled
- specifies whether context menu is enabled
-
getItemClickAction
- Returns:
- an action to be executed on double click on a DataGrid row,
assigned by
setItemClickAction(Action)
- See Also:
-
setItemClickAction
Assigns an action to be executed on double click on a DataGrid row.If such action is not set, the table responds to pressing Enter by trying to find and execute the following actions:
- action, assigned to Enter key press by setting its
shortcut
property - action named "edit"
- action named "view"
If one of these actions is found and it is enabled, it is executed.
- Parameters:
action
- an action to be executed on double click on a DataGrid row
- action, assigned to Enter key press by setting its
-
getEnterPressAction
- Returns:
- an action to be executed on Enter key press, assigned by
setEnterPressAction(Action)
- See Also:
-
setEnterPressAction
Assigns an action to be executed on Enter key press.If such action is not set, the table responds to pressing Enter by trying to find and execute the following actions:
- action, assigned by
setItemClickAction(Action)
- action, assigned to Enter key press by setting its
shortcut
property - action named "edit"
- action named "view"
If one of these actions is found and it is enabled, it is executed.
- Parameters:
action
- an action to be executed on Enter key press- See Also:
- action, assigned by
-
getFrozenColumnCount
int getFrozenColumnCount()Gets the number of frozen columns in this DataGrid. 0 means that no data columns will be frozen, but the built-in selection checkbox column will still be frozen if it's in use. -1 means that not even the selection column is frozen. NOTE: this count includeshidden columns
in the count.- Returns:
- the number of frozen columns
- See Also:
-
setFrozenColumnCount
@StudioProperty(name="frozenColumnCount", defaultValue="0") @Min(-1L) void setFrozenColumnCount(int numberOfColumns) Sets the number of frozen columns in this grid. Setting the count to 0 means that no data columns will be frozen, but the built-in selection checkbox column will still be frozen if it's in use. Setting the count to -1 will also disable the selection column.The default value is 0.
- Parameters:
numberOfColumns
- the number of columns that should be frozen- Throws:
IllegalArgumentException
- if the column count is < 0 or > the number of visible columns
-
isSortable
boolean isSortable()- Returns:
true
if individual column sortable attribute can be set totrue
,false
otherwise
-
setSortable
Defines if this attribute can be changed for individual column or not. Default value istrue
.- Parameters:
sortable
-true
if individual column sortable attribute can be set totrue
,false
otherwise
-
isColumnsCollapsingAllowed
boolean isColumnsCollapsingAllowed()- Returns:
true
if individual column collapsible attribute can be set totrue
,false
otherwise
-
setColumnsCollapsingAllowed
@StudioProperty(defaultValue="true") void setColumnsCollapsingAllowed(boolean columnsCollapsingAllowed) Defines if collapsible attribute can be changed for individual column or not. Default value istrue
.- Parameters:
columnsCollapsingAllowed
-true
if individual column collapsible attribute can be set totrue
,false
otherwise
-
isEditorEnabled
boolean isEditorEnabled()Checks whether the item editor UI is enabled for this DataGrid.- Returns:
true
if the editor is enabled for this grid- See Also:
-
setEditorEnabled
Sets whether or not the item editor UI is enabled for this DataGrid. When the editor is enabled, the user can open it by double-clicking a row or hitting enter when a row is focused. The editor can also be opened programmatically using theedit(Object)
method.- Parameters:
isEnabled
-true
to enable the feature,false
otherwise- See Also:
-
isEditorBuffered
boolean isEditorBuffered()Gets the buffered editor mode.- Returns:
true
if buffered editor is enabled,false
otherwise
-
setEditorBuffered
Sets the buffered editor mode. The default mode is buffered (true
).- Parameters:
editorBuffered
-true
to enable buffered editor,false
to disable it
-
getEditorSaveCaption
String getEditorSaveCaption()Gets the current caption of the save button in the DataGrid editor.- Returns:
- the current caption of the save button
-
setEditorSaveCaption
Sets the caption on the save button in the DataGrid editor.- Parameters:
saveCaption
- the caption to set
-
getEditorCancelCaption
String getEditorCancelCaption()Gets the current caption of the cancel button in the DataGrid editor.- Returns:
- the current caption of the cancel button
-
setEditorCancelCaption
Sets the caption on the cancel button in the DataGrid editor.- Parameters:
cancelCaption
- the caption to set
-
getEditedItem
Returns the item that is currently being edited.- Returns:
- the item that is currently being edited, or
null
if no item is being edited at the moment
-
isEditorActive
boolean isEditorActive()Returns whether an item is currently being edited in the editor.- Returns:
true
if the editor is open
-
closeEditor
void closeEditor()Closes editor if it's opened. -
edit
Opens the editor interface for the provided entity. Scrolls the Grid to bring the entity to view if it is not already visible.- Parameters:
item
- the item to edit- Throws:
IllegalStateException
- if the editor is not enabled or already editing an entity in buffered modeIllegalArgumentException
- if datasource doesn't contain the entity- See Also:
-
setEditorCrossFieldValidate
@StudioProperty(name="editorCrossFieldValidate", defaultValue="true") void setEditorCrossFieldValidate(boolean validate) Enables cross field validation in the inline editor. True by default.- Parameters:
validate
- validate option, true if an editor should validate cross field rules
-
isEditorCrossFieldValidate
boolean isEditorCrossFieldValidate()- Returns:
- true if editor validates cross field rules
-
addEditorPreCommitListener
Registers a new DataGrid editor pre commit listener. Works in buffered mode only.- Parameters:
listener
- the listener to register
-
addEditorPostCommitListener
Registers a new DataGrid editor post commit listener. Works in buffered mode only.- Parameters:
listener
- the listener to register
-
addEditorCloseListener
Registers a new DataGrid editor close listener.- Parameters:
listener
- the listener to register
-
addEditorOpenListener
Registers a new DataGrid editor open listener.- Parameters:
listener
- the listener to register
-
repaint
void repaint()Repaint UI representation of the DataGrid without refreshing the table data. -
scrollTo
Scrolls to a certain item, usingDataGrid.ScrollDestination.ANY
.- Parameters:
item
- item to scroll to- See Also:
-
scrollTo
Scrolls to a certain item, using user-specified scroll destination.- Parameters:
item
- item to scroll todestination
- value specifying desired position of scrolled-to row- See Also:
-
scrollToStart
void scrollToStart()Scrolls to the first data item. -
scrollToEnd
void scrollToEnd()Scrolls to the last data item. -
getColumnResizeMode
DataGrid.ColumnResizeMode getColumnResizeMode()Returns the current column resize mode. The default mode isDataGrid.ColumnResizeMode.ANIMATED
.- Returns:
- a ColumnResizeMode value
-
setColumnResizeMode
@StudioProperty(type=ENUMERATION, defaultValue="ANIMATED", options={"ANIMATED","SIMPLE"}) void setColumnResizeMode(DataGrid.ColumnResizeMode mode) Sets the column resize mode to use. The default mode isDataGrid.ColumnResizeMode.ANIMATED
.- Parameters:
mode
- a ColumnResizeMode value
-
getSelectionMode
DataGrid.SelectionMode getSelectionMode()- Returns:
- the currently used
DataGrid.SelectionMode
-
setSelectionMode
@StudioProperty(type=ENUMERATION, defaultValue="SINGLE", options={"SINGLE","MULTI","MULTI_CHECK","NONE"}) void setSelectionMode(DataGrid.SelectionMode selectionMode) Sets the DataGrid's selection mode.- Parameters:
selectionMode
- the selection mode to use
-
addRowStyleProvider
Adds style provider for the DataGrid rows.DataGrid can use several providers to obtain many style names for rows.
- Parameters:
styleProvider
- a style provider to add, not null
-
removeRowStyleProvider
Removes style provider for the DataGrid rows.- Parameters:
styleProvider
- a style provider to remove, not null
-
getRowDescriptionProvider
Returns theRowDescriptionProvider
instance used to generate descriptions (tooltips) for DataGrid rows- Returns:
- the description provider or null if no provider is set
-
setRowDescriptionProvider
Sets theRowDescriptionProvider
instance for generating optional descriptions (tooltips) for DataGrid rows. If aDataGrid.Column.setDescriptionProvider(Function)
is also set, the row description generated byprovider
is used for cells for which the cell description provider returns null.This method uses the
ContentMode.PREFORMATTED
content mode.- Parameters:
provider
- the description provider to use ornull
to remove a previously set provider if any
-
setRowDescriptionProvider
void setRowDescriptionProvider(@Nullable Function<? super E, String> provider, ContentMode contentMode) Sets theRowDescriptionProvider
instance for generating optional descriptions (tooltips) for DataGrid rows. If aDataGrid.Column.setDescriptionProvider(Function)
is also set, the row description generated byprovider
is used for cells for which the cell description provider returns null.- Parameters:
provider
- the description provider to use ornull
to remove a previously set provider if anycontentMode
- the content mode for row tooltips
-
addGeneratedColumn
DataGrid.Column<E> addGeneratedColumn(String columnId, Function<DataGrid.ColumnGeneratorEvent<E>, ?> generator) Add a generated column to the DataGrid.- Parameters:
columnId
- column identifier as defined in XML descriptorgenerator
- column generator instance- See Also:
-
addGeneratedColumn
DataGrid.Column<E> addGeneratedColumn(String columnId, Function<DataGrid.ColumnGeneratorEvent<E>, ?> generator, int index) Add a generated column to the DataGrid.- Parameters:
columnId
- column identifier as defined in XML descriptorgenerator
- column generator instanceindex
- index of a new generated column- See Also:
-
getColumnGenerator
Gets the columns generator for the given column id.- Parameters:
columnId
- the column id for which to return column generator- Returns:
- the column generator for given column id
-
getDetailsGenerator
- Returns:
- the current details generator for row details or
null
if not set
-
setDetailsGenerator
Sets a new details generator for row details.The currently opened row details will be re-rendered.
- Parameters:
detailsGenerator
- the details generator to set
-
isDetailsVisible
Checks whether details are visible for the given item.- Parameters:
entity
- the item for which to check details visibility- Returns:
true
if the details are visible
-
setDetailsVisible
Shows or hides the details for a specific item.- Parameters:
entity
- the item for which to set details visibilityvisible
-true
to show the details, orfalse
to hide them
-
addColumnCollapsingChangeListener
Subscription addColumnCollapsingChangeListener(Consumer<DataGrid.ColumnCollapsingChangeEvent> listener) Registers a new column collapsing change listener.- Parameters:
listener
- the listener to register
-
addColumnReorderListener
Registers a new column reorder listener.- Parameters:
listener
- the listener to register
-
addColumnResizeListener
Registers a new column resize listener.- Parameters:
listener
- the listener to register
-
addSelectionListener
Registers a new selection listener- Parameters:
listener
- the listener to register
-
addSortListener
Registers a new sort order change listener- Parameters:
listener
- the listener to register
-
addContextClickListener
Registers a new context click listener- Parameters:
listener
- the listener to register
-
addItemClickListener
Registers a new item click listener- Parameters:
listener
- the listener to register
-
getHeaderRow
Gets the header row at given index.- Parameters:
index
- 0 based index for row. Counted from top to bottom- Returns:
- header row at given index
-
appendHeaderRow
DataGrid.HeaderRow appendHeaderRow()Adds a new row at the bottom of the header section.- Returns:
- the new row
- See Also:
-
prependHeaderRow
DataGrid.HeaderRow prependHeaderRow()Adds a new row at the top of the header section.- Returns:
- the new row
- See Also:
-
addHeaderRowAt
Inserts a new row at the given position to the header section. Shifts the row currently at that position and any subsequent rows down (adds one to their indices).- Parameters:
index
- the position at which to insert the row- Returns:
- the new row
- See Also:
-
removeHeaderRow
Removes the given row from the header section.- Parameters:
headerRow
- the row to be removed- See Also:
-
removeHeaderRow
void removeHeaderRow(int index) Removes the row at the given position from the header section.- Parameters:
index
- the position of the row- See Also:
-
getDefaultHeaderRow
Returns the current default row of the header section. The default row is a special header row providing a user interface for sorting columns. Setting a header text for column updates cells in the default header.- Returns:
- the default row or null if no default row set
-
setDefaultHeaderRow
Sets the default row of the header. The default row is a special header row providing a user interface for sorting columns.- Parameters:
headerRow
- the new default row, or null for no default row
-
getHeaderRowCount
int getHeaderRowCount()Gets the row count for the header section.- Returns:
- row count
-
getSubPart
- Specified by:
getSubPart
in interfaceActionsHolder
- Specified by:
getSubPart
in interfaceHasSubParts
-
isAggregatable
boolean isAggregatable()- Returns:
- true if DataGrid is aggregatable
-
setAggregatable
Set to true if aggregation should be enabled. Default value is false.- Parameters:
aggregatable
- aggregatable option
-
getAggregationPosition
DataGrid.AggregationPosition getAggregationPosition()- Returns:
- return aggregation row position
-
setAggregationPosition
@StudioProperty(type=ENUMERATION, defaultValue="TOP", options={"TOP","BOTTOM"}) void setAggregationPosition(DataGrid.AggregationPosition position) Sets aggregation row position. Default value isDataGrid.AggregationPosition.TOP
.- Parameters:
position
- position:DataGrid.AggregationPosition.TOP
orDataGrid.AggregationPosition.BOTTOM
-
getAggregationResults
- Returns:
- aggregated values for columns
-
setEmptyStateMessage
Sets a message to the middle of DataGrid body that should be appeared when DataGrid is empty.- Parameters:
message
- message that appears when DataGrid is empty
-
getEmptyStateMessage
- Returns:
- message that should be appeared when DataGrid is empty
-
setEmptyStateLinkMessage
Sets a link message to the middle of DataGrid body that should be appeared when DataGrid is empty.- Parameters:
linkMessage
- message that appears when DataGrid is empty- See Also:
-
getEmptyStateLinkMessage
- Returns:
- link message that should be appeared when DataGrid is empty
-
setEmptyStateLinkClickHandler
Sets click handler for link message. Link message can be shown when DataGrid is empty.- Parameters:
handler
- handler to set- See Also:
-
getEmptyStateLinkClickHandler
- Returns:
- click handler for link message
-
getMinHeight
- Specified by:
getMinHeight
in interfaceHasMinSize
- Returns:
min-height
CSS property value of the Grid (not a composition) ornull
if not set
-
getMinHeightSizeUnit
- Specified by:
getMinHeightSizeUnit
in interfaceHasMinSize
- Returns:
- unit size of
min-height
CSS property value of the Grid (not a composition)
-
setMinHeight
SetsminHeight
CSS property value to the Grid (not a composition). To set CSS properties to the composition usecss
attribute in the XML descriptor orHtmlAttributes.applyCss(Component, String)
.- Specified by:
setMinHeight
in interfaceHasMinSize
- Parameters:
minHeight
- property value
-
getMinWidth
- Specified by:
getMinWidth
in interfaceHasMinSize
- Returns:
min-width
CSS property value of the Grid (not a composition) ornull
if not set
-
getMinWidthSizeUnit
- Specified by:
getMinWidthSizeUnit
in interfaceHasMinSize
- Returns:
- unit size of
min-width
CSS property value of the Grid (not a composition)
-
setMinWidth
SetsminWidth
CSS property value to the Grid (not a composition). To set CSS properties to the composition usecss
attribute in the XML descriptor orHtmlAttributes.applyCss(Component, String)
.- Specified by:
setMinWidth
in interfaceHasMinSize
- Parameters:
minWidth
- property value
-