Skip to content
Source
Sign inSign up
TanStack/table

fix: align grouped sticky headers #6472

Openbiubiukam(GitHub profile, opens in a new tab)wants to merge 4 commits intobeta fromrefs/pull/6472/headopened

Showing 2 changed files with 67 additions and 20 deletions (loading 1).

x
0 of 2 viewed, 2 left
67 additions and 20 deletionsexamples/react/column-pinning-sticky/src/main.tsxModified
View file
@@ -12,7 +12,7 @@
} from '@tanstack/react-table'
import { faker } from '@faker-js/faker'
import { makeData } from './makeData'
-import type { Column } from '@tanstack/react-table'
+import type { Column, Header } from '@tanstack/react-table'
import type { CSSProperties } from 'react'
import type { Person } from './makeData'
import './index.css'
@@ -31,12 +31,16 @@
// View the index.css file for more needed styles such as border-collapse: collapse
const getCommonPinningStyles = (
column: Column<typeof features, Person>,
+ firstLeafColumn = column,
+ lastLeafColumn = column,
+ width = column.getSize(),
+ pinnedPosition = column.getIsPinned(),
): CSSProperties => {
- const isPinned = column.getIsPinned()
+ const isPinned = pinnedPosition
const isLastLeftPinnedColumn =
- isPinned === 'start' && column.getIsLastColumn('start')
+ isPinned === 'start' && lastLeafColumn.getIsLastColumn('start')
const isFirstRightPinnedColumn =
- isPinned === 'end' && column.getIsFirstColumn('end')
+ isPinned === 'end' && firstLeafColumn.getIsFirstColumn('end')
​
return {
boxShadow: isLastLeftPinnedColumn