Skip to main content

Datagrid API

Properties
NameTypeDefaultDescription
idstringWhen set, the page size selector is saved to localStorage (requires Remember Settings).
dataarray[]Defines the datagrid data. Shows an empty state when not provided.
layout'table' | 'card''table'Default layout. Use 'card' together with e-datagrid-layout-card.
borderedbooleanfalseAdds a border to the datagrid.
loadingbooleanfalseShows the loading state. Disappears when data is loaded or the attribute is removed.
auto-focusbooleanfalseFocuses the search input when the datagrid is loaded.
action-typestring'primary'Defines the button type for actions.
sorting-keystringData field used for sorting.
sorting-order'asc' | 'desc''asc'Sort direction when sorting-key is set.
search-keysdeprecatedarray[]Defines which fields are used for searching. Use search-includes and search-exclude instead.
search-includesarray[]Extends the searchable fields beyond the rendered columns.
search-tooltipstringOverrides the default tooltip on the search field.
search-keywordstringSets a default search keyword.
search-hiddenbooleanfalseRemoves the search input from the header.
search-remember-excludedbooleanfalsePrevents the search keyword from being saved to storage.
pagination-hiddenbooleanfalseRemoves pagination and shows all data on one page.
page-sizestringSets the number of rows displayed per page.
page-size-hiddenbooleanfalseRemoves the page size selector.
serverstringURL to fetch data from. Shows an empty state if the server responds with an error.
server-error-statebooleanfalseShows the server error state. Disappears when data is set or the attribute is removed.
server-select-all-visiblebooleanfalseShows 'Select all' and 'Clear selection' in the bulk toolbar for server-side pagination. Requires id-key.
id-keystringProperty used as a unique row identifier for selection matching. If not set, selection clears when content changes.
customServerfunctionFunction alternative to server. Must return a promise or object in the same format as the server response.
horizontal-scroll-disabledbooleanfalseDisables horizontal scrolling; content uses the available space.
highlighted-keystringRow property used as the highlight identifier.
always-show-bulk-actionbooleanfalseKeeps the bulk action bar always visible.
filters-visiblebooleanfalseOpens the filters panel by default.
JavaScript API
NameKindDescription
selectedItemsgetter/setterGets or sets items selected by bulk actions. Accepts full row objects or objects with just the id field.
toggleFilterPanel()methodOpens or closes the filter panel based on its current state.
clearAllFilters()methodClears all filters except those with clear-hidden, disabled, or readonly set.
fetchData()methodFetches new data from the server when using the server or customServer option.
Events
EventDescriptionReturns
filterFires when any filter (including search) changes.{ detail: { filterValues, searchKeyword } }
pagesizechangeFires when the page size is changed via the selector.{ detail: { value } }
sortFires when column sorting changes.{ detail: { contentKey, order: 'asc' | 'desc' } }
selectFires when an item is selected in bulk mode.{ detail: { selectedItems } }