sticky column
This commit is contained in:
parent
8476b1de37
commit
8eded98a0b
@ -110,6 +110,8 @@ const HeaderCell = ({ header, table, pinningPosition, onClick, onChangeWidth })
|
||||
const isPinned = Boolean(pinningPosition);
|
||||
const leftOffset = pinningPosition === 'left' ? header.getStart() : undefined;
|
||||
const rightOffset = pinningPosition === 'right' ? table.getRightTotalSize() - header.getStart() - headerSize : undefined;
|
||||
const stickyTextLeft = isPinned ? undefined : table.getLeftTotalSize();
|
||||
const stickyTextRight = isPinned ? undefined : table.getRightTotalSize();
|
||||
|
||||
const customBgColor = column.columnDef?.muiTableHeadCellProps?.sx?.backgroundColor;
|
||||
|
||||
@ -161,11 +163,16 @@ const HeaderCell = ({ header, table, pinningPosition, onClick, onChangeWidth })
|
||||
<div
|
||||
style={{
|
||||
textAlign: 'center',
|
||||
position: 'relative',
|
||||
position: isPinned ? 'relative' : 'sticky',
|
||||
left: stickyTextLeft,
|
||||
right: stickyTextRight,
|
||||
zIndex: 1,
|
||||
paddingRight: '0.5rem',
|
||||
paddingLeft: '0.5rem',
|
||||
backgroundColor: backgroundColor,
|
||||
color: color,
|
||||
maxWidth: 'calc(100% - 1rem)',
|
||||
boxSizing: 'border-box',
|
||||
}}>
|
||||
{header.isPlaceholder ? null : column.columnDef.header}
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user