diff --git a/src-docs/src/views/datagrid/_snippets.tsx b/src-docs/src/views/datagrid/_snippets.tsx index fb0d3384e6c..c6a56cf67ee 100644 --- a/src-docs/src/views/datagrid/_snippets.tsx +++ b/src-docs/src/views/datagrid/_snippets.tsx @@ -8,15 +8,20 @@ inMemory={{ level: 'sorting' }}`, columns: `columns={[ { id: 'A', // required + display: <>Column A , // optional column header rendering + displayAsText: 'Column A', // column header as plain text initialWidth: 150, // starting width of 150px isResizable: false, // prevents the user from resizing width - actions: false, // no column header actions are displayed isExpandable: false, // doesn't allow clicking in to see the content in a popup - actions: { showMoveLeft: false, showMoveRight: false }, // doesn't show move actions in column header + isSortable: false, // prevents the user from sorting the data grid by this column + defaultSortDirection: 'asc', // sets the default sort direction schema: 'franchise', // custom schema later defined under schemaDetectors + actions: false, // no column header actions are displayed + actions: { showMoveLeft: false, showMoveRight: false }, // doesn't show move actions in column header cellActions: [ // provides one additional cell action that triggers an alert once clicked ({ Component }) => alert('test')}>Custom action, ], + visibleCellActions: 2, // configures the number of cell action buttons immediately visible on a cell }, ]}`, columnVisibility: `columnVisibility={{ diff --git a/src/components/datagrid/__snapshots__/data_grid.test.tsx.snap b/src/components/datagrid/__snapshots__/data_grid.test.tsx.snap index 6ee92c0d201..1090e005b7a 100644 --- a/src/components/datagrid/__snapshots__/data_grid.test.tsx.snap +++ b/src/components/datagrid/__snapshots__/data_grid.test.tsx.snap @@ -1075,6 +1075,7 @@ Array [ >
A
@@ -1118,6 +1119,7 @@ Array [ >
B
@@ -1514,6 +1516,7 @@ Array [ >
A
@@ -1557,6 +1560,7 @@ Array [ >
B
@@ -2250,6 +2254,7 @@ Array [ >
Column A
@@ -2293,6 +2298,7 @@ Array [ >
More Elements @@ -2669,6 +2675,7 @@ Array [ >
A
@@ -2712,6 +2719,7 @@ Array [ >
B
diff --git a/src/components/datagrid/body/__snapshots__/data_grid_body.test.tsx.snap b/src/components/datagrid/body/__snapshots__/data_grid_body.test.tsx.snap index 216a98d3640..a2dd1609e28 100644 --- a/src/components/datagrid/body/__snapshots__/data_grid_body.test.tsx.snap +++ b/src/components/datagrid/body/__snapshots__/data_grid_body.test.tsx.snap @@ -41,6 +41,7 @@ exports[`EuiDataGridBody renders 1`] = ` >
columnA
@@ -84,6 +85,7 @@ exports[`EuiDataGridBody renders 1`] = ` >
columnB
diff --git a/src/components/datagrid/body/header/__snapshots__/data_grid_header_cell.test.tsx.snap b/src/components/datagrid/body/header/__snapshots__/data_grid_header_cell.test.tsx.snap index 3f925e5e5d6..f02505a985c 100644 --- a/src/components/datagrid/body/header/__snapshots__/data_grid_header_cell.test.tsx.snap +++ b/src/components/datagrid/body/header/__snapshots__/data_grid_header_cell.test.tsx.snap @@ -23,6 +23,7 @@ exports[`EuiDataGridHeaderCell renders 1`] = ` >
someColumn
diff --git a/src/components/datagrid/body/header/data_grid_header_cell.tsx b/src/components/datagrid/body/header/data_grid_header_cell.tsx index f14e09a79a5..b55d8eecb55 100644 --- a/src/components/datagrid/body/header/data_grid_header_cell.tsx +++ b/src/components/datagrid/body/header/data_grid_header_cell.tsx @@ -140,7 +140,10 @@ export const EuiDataGridHeaderCell: FunctionComponent {sortingArrow} -
+
{display || displayAsText || id}
@@ -158,7 +161,10 @@ export const EuiDataGridHeaderCell: FunctionComponent {sortingArrow} -
+
{display || displayAsText || id}