diff --git a/src-docs/src/views/datagrid/ref.js b/src-docs/src/views/datagrid/ref.js index e043abcedc93..62a0f64b807b 100644 --- a/src-docs/src/views/datagrid/ref.js +++ b/src-docs/src/views/datagrid/ref.js @@ -148,6 +148,14 @@ export default () => { Set cell focus + + dataGridRef.current.setIsFullScreen(true)} + > + Set grid to full screen + + diff --git a/src/components/datagrid/data_grid.test.tsx b/src/components/datagrid/data_grid.test.tsx index a4200aab0ad6..66bd8cba9280 100644 --- a/src/components/datagrid/data_grid.test.tsx +++ b/src/components/datagrid/data_grid.test.tsx @@ -2744,6 +2744,7 @@ describe('EuiDataGrid', () => { ); expect(gridRef.current).toEqual({ + setIsFullScreen: expect.any(Function), setFocusedCell: expect.any(Function), }); }); diff --git a/src/components/datagrid/data_grid.tsx b/src/components/datagrid/data_grid.tsx index f5688219b830..d350c50c919c 100644 --- a/src/components/datagrid/data_grid.tsx +++ b/src/components/datagrid/data_grid.tsx @@ -290,6 +290,7 @@ export const EuiDataGrid = forwardRef( useImperativeHandle( ref, () => ({ + setIsFullScreen, setFocusedCell: ({ rowIndex, colIndex }) => { focusContext.setFocusedCell([colIndex, rowIndex]); }, diff --git a/src/components/datagrid/data_grid_types.ts b/src/components/datagrid/data_grid_types.ts index ba23040dba92..bc1a9169f69e 100644 --- a/src/components/datagrid/data_grid_types.ts +++ b/src/components/datagrid/data_grid_types.ts @@ -284,6 +284,10 @@ export type EuiDataGridProps = OneOf< >; export interface EuiDataGridRefProps { + /** + * Allows manually controlling the full-screen state of the grid. + */ + setIsFullScreen(isFullScreen: boolean): void; /** * Allows manually focusing the specified cell in the grid. *