-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #317 from icflorescu/next
Allow idAccessor to be a function
- Loading branch information
Showing
13 changed files
with
537 additions
and
518 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { DataTable } from 'mantine-datatable'; | ||
|
||
export default function NonStandardRecordIdsFunctionExample() { | ||
return ( | ||
<DataTable | ||
withBorder | ||
withColumnBorders | ||
striped | ||
records={[ | ||
{ bookTitle: 'The Fellowship of the Ring', character: 'Frodo Baggins', bornIn: 2968 }, | ||
// example-skip more records | ||
{ bookTitle: 'The Fellowship of the Ring', character: 'Samwise Gamgee', bornIn: 2980 }, | ||
{ bookTitle: 'The Fellowship of the Ring', character: 'Meriadoc Brandybuck', bornIn: 2982 }, | ||
{ bookTitle: 'The Fellowship of the Ring', character: 'Peregrin Took', bornIn: 2990 }, | ||
{ bookTitle: 'The Fellowship of the Ring', character: 'Gandalf', bornIn: 1000 }, | ||
{ bookTitle: 'The Fellowship of the Ring', character: 'Aragorn son of Arathorn', bornIn: 2931 }, | ||
{ bookTitle: 'The Fellowship of the Ring', character: 'Legolas', bornIn: 2931 }, | ||
{ bookTitle: 'The Fellowship of the Ring', character: 'Gimli son of Gloin', bornIn: 2879 }, | ||
{ bookTitle: 'The Fellowship of the Ring', character: 'Boromir son of Denethor', bornIn: 2978 }, | ||
{ bookTitle: 'The Two Towers', character: 'Frodo Baggins', bornIn: 2968 }, | ||
{ bookTitle: 'The Two Towers', character: 'Samwise Gamgee', bornIn: 2980 }, | ||
{ bookTitle: 'The Two Towers', character: 'Meriadoc Brandybuck', bornIn: 2982 }, | ||
{ bookTitle: 'The Two Towers', character: 'Peregrin Took', bornIn: 2990 }, | ||
{ bookTitle: 'The Two Towers', character: 'Gandalf', bornIn: 1000 }, | ||
{ bookTitle: 'The Two Towers', character: 'Aragorn son of Arathorn', bornIn: 2931 }, | ||
{ bookTitle: 'The Two Towers', character: 'Legolas', bornIn: 2931 }, | ||
{ bookTitle: 'The Two Towers', character: 'Gimli son of Gloin', bornIn: 2879 }, | ||
{ bookTitle: 'The Two Towers', character: 'Boromir son of Denethor', bornIn: 2978 }, | ||
{ bookTitle: 'The Return of the King', character: 'Frodo Baggins', bornIn: 2968 }, | ||
{ bookTitle: 'The Return of the King', character: 'Samwise Gamgee', bornIn: 2980 }, | ||
{ bookTitle: 'The Return of the King', character: 'Meriadoc Brandybuck', bornIn: 2982 }, | ||
{ bookTitle: 'The Return of the King', character: 'Peregrin Took', bornIn: 2990 }, | ||
{ bookTitle: 'The Return of the King', character: 'Gandalf', bornIn: 1000 }, | ||
// example-resume | ||
]} | ||
columns={[ | ||
{ accessor: 'character', width: '100%' }, | ||
{ accessor: 'bornIn', textAlignment: 'right' }, | ||
{ accessor: 'bookTitle', noWrap: true }, | ||
]} | ||
/** | ||
* Non-standard record ID. | ||
* In this case we're using a function that returns a "composite" ID | ||
*/ | ||
idAccessor={({ bookTitle, character }) => `${bookTitle}:${character}`} | ||
/> | ||
); | ||
} |
File renamed without changes.
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
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
Oops, something went wrong.