File tree 1 file changed +15
-0
lines changed
frontend/src/components/common/Table
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -320,6 +320,21 @@ export default function Table<RowItem extends Record<string, any>>({
320
320
} ,
321
321
} ) ;
322
322
323
+ // Hide actions column when others are hidden
324
+ useEffect ( ( ) => {
325
+ const visibility = table . getState ( ) . columnVisibility || { } ;
326
+
327
+ const shouldHideActions = tableColumns
328
+ . filter ( col => ( col . id ?? '' ) !== 'actions' )
329
+ . every ( col => visibility [ col . id ?? '' ] === false ) ;
330
+
331
+ if ( shouldHideActions && visibility [ 'actions' ] !== false ) {
332
+ table . setColumnVisibility ( prev => ( { ...prev , actions : false } ) ) ;
333
+ } else if ( ! shouldHideActions && visibility [ 'actions' ] === false ) {
334
+ table . setColumnVisibility ( prev => ( { ...prev , actions : true } ) ) ;
335
+ }
336
+ } , [ table . getState ( ) . columnVisibility , tableColumns , table ] ) ;
337
+
323
338
const gridTemplateColumns = useMemo ( ( ) => {
324
339
let preGridTemplateColumns = tableProps . columns
325
340
. filter ( ( it , i ) => {
You can’t perform that action at this time.
0 commit comments