Data grid schemas and popovers

Schemas are data types you pass to grid columns to affect how the columns and expansion popovers render. Schemas also allow you to define individual sorting comparators so that sorts can do more than just A-Z comparisons. By default, EuiDataGrid ships with a few built-in schemas for numeric, currency, datetime, boolean and json data. When the inMemory prop is in use it will automatically try to figure out the best schema based on the inMemory: {{ level: value }} you set, but this will come with the caveat that you will need to provide and manage sorting outside the component. In general we recommend passing schema information to your columns instead of using auto-detection when you have that knowledge of your data available during ingestion.

Defining custom schemas

Custom schemas are passed as an array to schemaDetectors and are constructed against the EuiDataGridSchemaDetector interface. You can see an example of a simple custom schema used on the last column below. In addition to schemas being useful to map against for cell and expansion rendering, any schema will also add aclassName="euiDataGridRowCell--schemaName" to each matching cell.

Defining expansiom

Likewise, you can inject custom content into any of the popovers a cell expands into. Add popoverContents functions to populate a matching schema's popover using a new component. You can see an example of this by clicking into one of the cells in the last column below.

Disabling expansion popovers

Often the popovers are unnecessary for short form content. In the example below we've turned them off by setting isExpandable=false on the boolean column.

default
boolean
numeric
currency
datetime
json
custom

Row: 1, Column: 1:

Dickens, Braxton DVM

Row: 1, Column: 2:

true

Row: 1, Column: 3:

07575672

Row: 1, Column: 4:

$673.54

Row: 1, Column: 5:

Thu Oct 24 2019 11:49:28 GMT+0100 (British Summer Time)

Row: 1, Column: 6:

[{"default":"Marks, Maritza DVM","boolean":"true","numeric":"27451301","currency":"$632.59","date":"Thu Dec 13 2018 13:35:13 GMT+0000 (Greenwich Mean Time)","custom":"Fri Sep 27 2019 11:53:47 GMT+0100 (British Summer Time)"}]

Row: 1, Column: 7:

Star Wars

Row: 2, Column: 1:

Smith, Valentin Sr.

Row: 2, Column: 2:

false

Row: 2, Column: 3:

36961991

Row: 2, Column: 4:

$838.02

Row: 2, Column: 5:

Thu Jul 04 2019 15:32:09 GMT+0100 (British Summer Time)

Row: 2, Column: 6:

[{"default":"Haag, Roxane DDS","boolean":"false","numeric":"77651814","currency":"$314.28","date":"Tue Sep 24 2019 18:44:05 GMT+0100 (British Summer Time)","custom":"Sun Mar 17 2019 13:22:48 GMT+0000 (Greenwich Mean Time)"}]

Row: 2, Column: 7:

Star Wars

Row: 3, Column: 1:

Bauch, Shania DDS

Row: 3, Column: 2:

true

Row: 3, Column: 3:

72050844

Row: 3, Column: 4:

$861.61

Row: 3, Column: 5:

Wed Apr 17 2019 13:56:59 GMT+0100 (British Summer Time)

Row: 3, Column: 6:

[{"name":"Jast, Landen DDS"}]

Row: 3, Column: 7:

Star Trek

Row: 4, Column: 1:

Reinger, Jamal I

Row: 4, Column: 2:

false

Row: 4, Column: 3:

85590116

Row: 4, Column: 4:

$82.27

Row: 4, Column: 5:

Sun Nov 10 2019 21:27:57 GMT+0000 (Greenwich Mean Time)

Row: 4, Column: 6:

[{"name":"Greenholt, Kenyatta V"}]

Row: 4, Column: 7:

Star Trek