kor TürkçeGitHub

DataGrid

A table for large lists: virtual rows, range selection with live totals, inline editing, and copy and paste with Excel.

kor/ui/DataGridSource

When to use

  • Users compare, total or edit many rows.
  • Rows come from any UI5 list binding: JSON, OData V2 or V4. No template is needed.

When not to use

  • Hierarchical data: use TreeGrid.
  • A handful of facts about one object: use Stat or Text.

Examples

Orders

500 rows. Drag across amounts to see their total, double-click a customer to edit it.

Loading the example

<k:DataGrid rows="{/orders}" selectionMode="Multi" height="26rem" label="Orders" rowPress=".onOpen" cellChange=".onChange">
	<k:columns>
		<k:Column label="Order" path="Id" type="link" width="120" pinned="true"/>
		<k:Column label="Customer" path="Customer" grow="1" editable="true"/>
		<k:Column label="Amount" path="Amount" type="currency" unitPath="Currency" decimals="2"/>
		<k:Column label="Due" path="Due" type="date"/>
		<k:Column label="Status" path="Status" type="status"
			states="{/states}"
			formatter=".statusText"/>
	</k:columns>
</k:DataGrid>

API

Properties

NameTypeDefaultDescription
heightsap.ui.core.CSSSize32remGrid height
selectionModestringNoneRow selection mode, None or Multi
summarybooleantrueWhether to show the summary bar
noDatastringMessage shown when there are no rows
labelstringAccessible name

Aggregations

NameTypeDescription
columnsColumn[]Grid columns
rowssap.ui.core.Element[]Rows supplied by a list binding without a template

Events

NameTypeDescription
rowPresscontext: objectA row was opened via a link cell or Enter
cellChangecontext: object
path: string
value: any
oldValue: any
A cell changed. The value has already been written to the model
stateChangeColumn order, width or sorting changed
selectionChangecontexts: objectRow selection changed

Methods

NameDescription
getState(): objectReturns column order, hidden columns, widths and sort order for saving
setState(state: { order?: string[]; hidden?: string[]; widths?: Record<string, number>; sort?: string; desc?: boolean }): voidRestores saved state and skips unknown columns
openSettings(opener: Control | HTMLElement): voidOpens column settings next to the supplied opener
getSelectedContexts(): Context[]Returns selected row contexts in selection order
clearSelection(): voidClears row selection

Column

A column in a DataGrid or TreeGrid.

Properties

NameTypeDefaultDescription
labelstringHeader
pathstringField path relative to the row context
typestringtexttext, link, number, currency, date, status, progress, person or spark
widthfloat140Width in pixels
growfloat0Share of the available extra width
decimalsint0Number of decimal places
unitPathstringPath to the unit or currency field
statePathstringPath to a status field with success, wait, danger, info or none
statesobjectMapping from cell values to statuses
optionsobjectChoices offered when editing
editablebooleanfalseWhether cells can be edited
sortablebooleantrueWhether the column can be sorted
pinnedbooleanfalseWhether this leading column stays in place during horizontal scrolling
formatterfunctionFunction that formats a value and row context as text

Related

TreeGridFilterBarVariants