Any one who how to Freeze Table Column or Row

Freeze Table Column or Row
2 Replies
Dennis Koch
Dennis Koch5mo ago
What does this even mean? 🤷🏼‍♂️
James
James4mo ago
I think he means to make it so a column doesn't scroll, e.g. on the left if its someones name or an id solution:
TextColumn::make('user.loginCode.code')
->label('Code')
->extraHeaderAttributes([
'style' => 'position: sticky; left: 0; z-index: 1;',
'class' => 'bg-gray-50 dark:bg-gray-900',
])
->extraCellAttributes([
'style' => 'position: sticky; left: 0; z-index: 1;',
'class' => 'bg-white dark:bg-gray-900',
])
TextColumn::make('user.loginCode.code')
->label('Code')
->extraHeaderAttributes([
'style' => 'position: sticky; left: 0; z-index: 1;',
'class' => 'bg-gray-50 dark:bg-gray-900',
])
->extraCellAttributes([
'style' => 'position: sticky; left: 0; z-index: 1;',
'class' => 'bg-white dark:bg-gray-900',
])
using position: sticky and left to freeze column. You also have to set the bg colour. It's not perfect with bg in dark mode unfortuantely as the header has a transparent shade rather than a fixed colour, but this looks good enough.... The bg colours need to be set as their bg is by default transparent