Page size selector is saved to localStorage if id is specified.
string
data
Defines datagrid data. If no data is given, empty state is displayed.
array
[]
layout
Default layout to the card layout you need to define the card view with e-datagrid-layout-card
card|table
table
bordered
Adds border to the datagrid component
boolean
false
loading
If true, shows the loading state. It will disappear when server side data has been loaded or when the attribute/property removed manually
boolean
false
auto-focus
If true, focus the search input when datagrid is loaded.
boolean
false
action-type
Defines the button type
string
"primary"
sorting-key
Defines the field on the data that will be used for sorting.
string
sorting-order
If sorting-key is set this attribute defines the sorting order
"asc" | "desc"
"asc"
search-keysDeprecated
Please use `search-includes` and `search-exclude` attributes insetead of this. Defines which fields will be used for searching. If not set, all rendered columns are used.
array
[]
search-includes
Defines which fields extends the rendered columns in searching.
array
[]
search-tooltip
Overrides default tooltip on search field.
string
search-keyword
Defines default search keyword
string
search-hidden
If true, removes search input from header.
boolean
false
pagination-hidden
If true, removes pagination and shows all data in one page
boolean
false
page-size
Sets the number of displayed rows shown on one page.
string
page-size-hidden
If true, remove page size selector
boolean
false
server
Defines the url where data comes from. If server responds with error, empty state is displayed.
string
server-error-state
If true, shows the server error state. It will disappear when data has been set or when the attribute/property removed manually
boolean
false
server-select-all-visible
If true, there will be "Select all" and "Clear selection" options on the bulk selection toolbar even if the datagrid uses server side pagination. In this case after a "Select all" the isSelectionInverted property will be true on the trigger event of the bulk action and the data will contain the unselected items. The id-key attibute also has to be set in order to work.
boolean
false
id-key
Defines which property on the rows can serve as an identifier for matching rows in selection with the data from server. If it is not set, selection will be cleared when the content changes.
string
customServer
A function that acts like the server. A promise or object must be returned in the same format you would answer for the server one. See the example below (example)
function
horizontal-scroll-disabled
If true, disable horizontal scrolling and the content must use the space available.
boolean
false
highlighted-key
Defines which property on the rows can serve as an identifier for highlighting.
string
JavaScript API
Name
Type
Description
Arguments
selectedItems
Gets or sets the list of items that are selected by bulk actions
Gets new data from server if datagrid uses the server or the customServer options
*: An array of entire objects for items in the data of the datagrid, with all their
fields, or if there is an id (unique) field that can be passed too on its own as seen in the example below:
Defines the table action(s). If you insert multiple instances of the component, the first will the the primary, additional actions will be available in the dropdown. If you add 2 actions, the first action will be the primary button, the second action
will be a regular button.
Properties
Name
Description
Type
Required
Default value
label
Defines the label of the action.
string
true
tooltip
Defines tooltip for actions.
string
disabled
Disables action.
boolean
false
disabled-tooltip
Defines tooltip for disabled actions.
string
disabled-type
If you want to show permission information in tooltip, use this attribute
- | "permission"
url
Defines the url of the link
string
dialog
Defines the query selector of dialog which can be opened on action click
string
-
target
Defines the target context of the linked URL
string
Events
Event
Description
Returns
trigger
Fires on the component when the action is clicked.
Defines type of column. It affects format, alignment and behaviour (e.g. search). Content should be ISO Date when type is time, it should be integer (seconds) when type is duration.
"time" | "duration"
"time"
format
If type is time, it defines which part of the time will be displayed (the actual format depends on the config)
Defines the tooltip around the action when disabled.
string
Events
Event
Description
Returns
trigger
Fires on action click. The isSelectionInverted will be true only if the datagrid uses server side pagination and the user used "Select all" and there was no "Clear selection" after that.
Defines relation between data and groups. We use the data for create group and the label, order will be alphabetical.
string
true
groups
You can define groups manually, order will be the same as in your data
string
default-label
You can set custom label to uncatogarised items group.
This will be used only if you define groups manually and some of the data not matching of any groups.
This should be the same value that came with the request that you answering.
content
array
The same object what you would pass to the datagrid with its data property.
itemCount
number
The total number of rows without filtering applied.
filteredItemCount
number
The number of rows with filtering applied.
Custom Server Example
Instead of the server property, you can use a customServer function, so you have absolute control over what should happen when something changes in the datagrid.