-
-
Notifications
You must be signed in to change notification settings - Fork 397
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5d2cb7
commit 8b13064
Showing
15 changed files
with
207 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
apps/material-react-table-docs/example-groups/VirtualizedExamples.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { useRouter } from 'next/router'; | ||
import { Box, Tab, Tabs } from '@mui/material'; | ||
import FullyVirtualizedExample from '../examples/virtualized'; | ||
import RowVirtualization from '../examples/enable-row-virtualization'; | ||
import ColumnVirtualization from '../examples/enable-column-virtualization'; | ||
import InfiniteScrolling from '../examples/infinite-scrolling'; | ||
import { useState } from 'react'; | ||
import Link from 'next/link'; | ||
import LaunchIcon from '@mui/icons-material/Launch'; | ||
|
||
const VirtualizedExamples = ({ isPage = false }) => { | ||
const { pathname, push } = useRouter(); | ||
const [activeTab, setActiveTab] = useState( | ||
isPage ? pathname.split('/').pop() : 'export-csv', | ||
); | ||
|
||
return ( | ||
<> | ||
<Box sx={{ borderBottom: 1, borderColor: 'divider' }}> | ||
<Tabs | ||
value={isPage ? pathname.split('/').pop() : activeTab} | ||
onChange={(_e, newPath) => | ||
isPage && newPath !== 'more' | ||
? push(newPath as string) | ||
: setActiveTab(newPath as string) | ||
} | ||
> | ||
<Tab label="Fully Virtualized" value="virtualized" /> | ||
<Tab label="Row Virtualization" value="row-virtualization" /> | ||
<Tab label="Column Virtualization" value="column-virtualization" /> | ||
<Tab label="Infinite Scrolling" value="infinite-scrolling" /> | ||
<Link href="/docs/examples" passHref legacyBehavior> | ||
<Tab | ||
label={ | ||
<Box> | ||
More Examples | ||
<LaunchIcon sx={{ fontSize: '1rem' }} /> | ||
</Box> | ||
} | ||
value="more" | ||
/> | ||
</Link> | ||
</Tabs> | ||
</Box> | ||
<Box> | ||
{activeTab === 'virtualized' && <FullyVirtualizedExample />} | ||
{activeTab === 'row-virtualization' && <RowVirtualization />} | ||
{activeTab === 'column-virtualization' && <ColumnVirtualization />} | ||
{activeTab === 'infinite-scrolling' && <InfiniteScrolling />} | ||
</Box> | ||
</> | ||
); | ||
}; | ||
|
||
export default VirtualizedExamples; |
32 changes: 32 additions & 0 deletions
32
apps/material-react-table-docs/pages/docs/examples/column-virtualization.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Head from 'next/head'; | ||
import Examples from '../../../example-groups/VirtualizedExamples'; | ||
|
||
<Head> | ||
<title>{'Column Virtualization Example - Material React Table V2 Docs'}</title> | ||
<meta | ||
name="description" | ||
content="An example of a Material React Table with column virtualization enabled to achieve higher performance when rendering large data sets" | ||
/> | ||
<meta | ||
property="og:title" | ||
content="Column Virtualization in Material React Table Example" | ||
/> | ||
<meta | ||
property="og:description" | ||
content="Learn how to enable column virtualization features in Material React Table" | ||
/> | ||
</Head> | ||
|
||
## Column Virtualization Example | ||
|
||
Material React Table has a built-in column virtualization feature (via [`@tanstack/react-virual`](https://tanstack.com/virtual/v3)) that lets you to render a large number of columns without major performance issues that you would normally see with a large number of DOM elements. | ||
|
||
Try out the performance of the table below with **500 columns**! Filtering, Search, and Sorting also maintain usable performance. | ||
|
||
Be sure to also check out the full [virtualization feature guide docs](/docs/guides/virtualization) to learn about both Row and Column Virtualization. | ||
|
||
> NOTE: You should only enable row virtualization if you have a large number of rows or columns. Depending on the size of the table, if you are rendering fewer than a couple dozen rows at a time, you will actually just be adding extra overhead to the table renders. Virtualization only becomes necessary when you have over 50 rows or so at the same time with no pagination or dozens of columns. | ||
<Examples isPage /> | ||
|
||
View Extra Storybook **[Examples](https://www.material-react-table.dev/?path=/story/features-virtualization--enable-row-virtualization)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
apps/material-react-table-docs/pages/docs/examples/popover-filters.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Head from 'next/head'; | ||
import Examples from '../../../example-groups/FilteringExamples'; | ||
|
||
<Head> | ||
<title>{'Popover Filters Example - Material React Table V2 Docs'}</title> | ||
<meta | ||
name="description" | ||
content="An example of Material React Table which shows an excel-like column filters." | ||
/> | ||
<meta | ||
property="og:title" | ||
content="Popover Filters Material React Table Example" | ||
/> | ||
<meta | ||
property="og:description" | ||
content="An example of Material React Table which shows an excel-like column filters." | ||
/> | ||
</Head> | ||
|
||
## Popover Filters Example | ||
|
||
Material React Table supports displaying column filters in other ways than in the default sub-header location. This example shows how to only show column filters when the user clicks on the filter icon in the header, and then display the filters in a popover. Learn more in the full [Column Filtering Feature Guide](/docs/guides/column-filtering). | ||
|
||
<Examples isPage /> | ||
|
||
View Extra Storybook **[Examples](https://www.material-react-table.dev/?path=/story/prop-playground--default)** |
32 changes: 32 additions & 0 deletions
32
apps/material-react-table-docs/pages/docs/examples/row-virtualization.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import Head from 'next/head'; | ||
import Examples from '../../../example-groups/VirtualizedExamples'; | ||
|
||
<Head> | ||
<title>{'Row Virtualization Example - Material React Table V2 Docs'}</title> | ||
<meta | ||
name="description" | ||
content="An example of a Material React Table with row virtualization enabled to achieve higher performance when rendering large data sets" | ||
/> | ||
<meta | ||
property="og:title" | ||
content="Row Virtualization in Material React Table Example" | ||
/> | ||
<meta | ||
property="og:description" | ||
content="Learn how to enable row virtualization features in Material React Table" | ||
/> | ||
</Head> | ||
|
||
## Row Virtualization Example | ||
|
||
Material React Table has a built-in row virtualization feature (via [`@tanstack/react-virual`](https://tanstack.com/virtual/v3)) that lets you to render a large number of rows without major performance issues that you would normally see with a large number of DOM elements. | ||
|
||
Try out the performance of the table below with **10,000 rows**! Filtering, Search, and Sorting also maintain usable performance. | ||
|
||
Be sure to also check out the full [virtualization feature guide docs](/docs/guides/virtualization) to learn about both Row and Column Virtualization. | ||
|
||
> NOTE: You should only enable row virtualization if you have a large number of rows or columns. Depending on the size of the table, if you are rendering fewer than a couple dozen rows at a time, you will actually just be adding extra overhead to the table renders. Virtualization only becomes necessary when you have over 50 rows or so at the same time with no pagination or dozens of columns. | ||
<Examples isPage /> | ||
|
||
View Extra Storybook **[Examples](https://www.material-react-table.dev/?path=/story/features-virtualization--enable-row-virtualization)** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters