Skip to content

Commit 63710d1

Browse files
authored
docs(AnalyticalTable): outline initialState more prominently (#6386)
1 parent b196a14 commit 63710d1

File tree

1 file changed

+29
-0
lines changed
  • packages/main/src/components/AnalyticalTable

1 file changed

+29
-0
lines changed

packages/main/src/components/AnalyticalTable/Recipes.mdx

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,4 +296,33 @@ const columns = [
296296
];
297297
```
298298

299+
## How to initially set a table state?
300+
301+
To initially select or expand a row; reorder, filter, group, hide or sort a column you can use the `reactTableOptions.initialState` object:
302+
303+
```jsx
304+
<AnalyticalTable
305+
{...otherProps}
306+
reactTableOptions={{
307+
initialState: {
308+
columnOrder: ['age', 'name'],
309+
filters: [{ id: 'age', value: '27' }],
310+
groupBy: ['age'],
311+
hiddenColumns: ['name'],
312+
selectedRowIds: { 2: true, 5: true, ['18.3']: true },
313+
sortBy: [
314+
{
315+
id: 'age',
316+
desc: true
317+
}
318+
],
319+
expanded: {
320+
18: true,
321+
18.3: true
322+
}
323+
}
324+
}}
325+
/>
326+
```
327+
299328
<Footer />

0 commit comments

Comments
 (0)