Skip to content

Commit

Permalink
Update documentation/examples
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Jan 11, 2022
1 parent 3f4282e commit 4064ded
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src-docs/src/views/datagrid/datagrid_ref_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const dataGridRefSource = require('!!raw-loader!./ref');
const dataGridRefSnippet = `const dataGridRef = useRef();
<EuiDataGrid ref={dataGridRef} {...props} />
// Mnaually toggle the data grid's full screen state
dataGridRef.current.setIsFullScreen(true);
// Mnaually focus a specific cell within the data grid
dataGridRef.current.setFocusedCell({ rowIndex, colIndex });
`;
Expand All @@ -37,6 +40,13 @@ export const DataGridRefExample = {
the <EuiCode>ref</EuiCode> prop of EuiDataGrid. These methods are:
</p>
<ul>
<li>
<p>
<EuiCode>setIsFullScreen(isFullScreen)</EuiCode> - controls the
full screen state of the data grid. Accepts a true/false boolean
flag.
</p>
</li>
<li>
<EuiCode>setFocusedCell({'{ rowIndex, colIndex }'})</EuiCode> -
focuses the specified cell in the grid.
Expand Down
8 changes: 8 additions & 0 deletions src-docs/src/views/datagrid/ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ export default () => {
Set cell focus
</EuiButton>
</EuiFlexItem>
<EuiFlexItem>
<EuiButton
size="s"
onClick={() => dataGridRef.current.setIsFullScreen(true)}
>
Set grid to full screen
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer />

Expand Down

0 comments on commit 4064ded

Please sign in to comment.