MCPcopy
hub / github.com/TanStack/table / App

Function App

examples/react/row-selection/src/main.tsx:19–295  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17} from '@tanstack/react-table'
18
19function App() {
20 const rerender = React.useReducer(() => ({}), {})[1]
21
22 const [rowSelection, setRowSelection] = React.useState({})
23 const [globalFilter, setGlobalFilter] = React.useState('')
24
25 const columns = React.useMemo<ColumnDef<Person>[]>(
26 () => [
27 {
28 id: 'select',
29 header: ({ table }) => (
30 <IndeterminateCheckbox
31 {...{
32 checked: table.getIsAllRowsSelected(),
33 indeterminate: table.getIsSomeRowsSelected(),
34 onChange: table.getToggleAllRowsSelectedHandler(),
35 }}
36 />
37 ),
38 cell: ({ row }) => (
39 <div className="px-1">
40 <IndeterminateCheckbox
41 {...{
42 checked: row.getIsSelected(),
43 disabled: !row.getCanSelect(),
44 indeterminate: row.getIsSomeSelected(),
45 onChange: row.getToggleSelectedHandler(),
46 }}
47 />
48 </div>
49 ),
50 },
51 {
52 header: 'Name',
53 footer: props => props.column.id,
54 columns: [
55 {
56 accessorKey: 'firstName',
57 cell: info => info.getValue(),
58 footer: props => props.column.id,
59 },
60 {
61 accessorFn: row => row.lastName,
62 id: 'lastName',
63 cell: info => info.getValue(),
64 header: () => <span>Last Name</span>,
65 footer: props => props.column.id,
66 },
67 ],
68 },
69 {
70 header: 'Info',
71 footer: props => props.column.id,
72 columns: [
73 {
74 accessorKey: 'age',
75 header: () => 'Age',
76 footer: props => props.column.id,

Callers

nothing calls this directly

Calls 11

makeDataFunction · 0.90
useReactTableFunction · 0.90
flexRenderFunction · 0.90
getCoreRowModelFunction · 0.85
getFilteredRowModelFunction · 0.85
getPaginationRowModelFunction · 0.85
getContextMethod · 0.80
previousPageMethod · 0.80
nextPageMethod · 0.80
refreshDataFunction · 0.70
rerenderFunction · 0.50

Tested by

no test coverage detected