mirror of
https://github.com/gosticks/react-table.git
synced 2025-10-16 11:55:36 +00:00
fix: fix column-ordering example
This commit is contained in:
parent
e7722b1d95
commit
0486c5c787
@ -79,7 +79,6 @@ function Table({ columns, data }) {
|
|||||||
))}
|
))}
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<AnimatePresence>
|
|
||||||
{rows.slice(0, 10).map(
|
{rows.slice(0, 10).map(
|
||||||
(row, i) =>
|
(row, i) =>
|
||||||
prepareRow(row) || (
|
prepareRow(row) || (
|
||||||
@ -92,7 +91,6 @@ function Table({ columns, data }) {
|
|||||||
</tr>
|
</tr>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
</AnimatePresence>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<pre>
|
<pre>
|
||||||
|
|||||||
@ -121,8 +121,8 @@ export const useTable = (props, ...plugins) => {
|
|||||||
|
|
||||||
// Make the headerGroups
|
// Make the headerGroups
|
||||||
const headerGroups = React.useMemo(
|
const headerGroups = React.useMemo(
|
||||||
() => makeHeaderGroups(flatColumns, columns, defaultColumn),
|
() => makeHeaderGroups(flatColumns, defaultColumn),
|
||||||
[columns, defaultColumn, flatColumns]
|
[defaultColumn, flatColumns]
|
||||||
)
|
)
|
||||||
|
|
||||||
const headers = React.useMemo(() => headerGroups[0].headers, [headerGroups])
|
const headers = React.useMemo(() => headerGroups[0].headers, [headerGroups])
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import React from 'react'
|
|||||||
|
|
||||||
const columnFallbacks = {
|
const columnFallbacks = {
|
||||||
Header: () => null,
|
Header: () => null,
|
||||||
Cell: ({ cell: { value = '' } }) => value,
|
Cell: ({ cell: { value = '' } }) => String(value),
|
||||||
show: true,
|
show: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,11 +79,9 @@ export function decorateColumnTree(columns, defaultColumn, parent, depth = 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build the header groups from the bottom up
|
// Build the header groups from the bottom up
|
||||||
export function makeHeaderGroups(flatColumns, columns, defaultColumn) {
|
export function makeHeaderGroups(flatColumns, defaultColumn) {
|
||||||
const headerGroups = []
|
const headerGroups = []
|
||||||
|
|
||||||
const maxDepth = findMaxDepth(columns)
|
|
||||||
|
|
||||||
// Build each header group from the bottom up
|
// Build each header group from the bottom up
|
||||||
const buildGroup = (columns, depth) => {
|
const buildGroup = (columns, depth) => {
|
||||||
const headerGroup = {
|
const headerGroup = {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user