@@ -27,7 +27,10 @@ import {
2727 useTheme ,
2828 viewStyleProps ,
2929} from '@deephaven/components' ;
30- import { useDashboardColumnFilters } from '@deephaven/dashboard-core-plugins' ;
30+ import {
31+ useDashboardColumnFilters ,
32+ useGridLinker ,
33+ } from '@deephaven/dashboard-core-plugins' ;
3134import { useApi } from '@deephaven/jsapi-bootstrap' ;
3235import type { dh as DhType } from '@deephaven/jsapi-types' ;
3336import Log from '@deephaven/log' ;
@@ -286,6 +289,14 @@ export function UITable({
286289 model . setColorMap ( colorMap ) ;
287290 }
288291
292+ const {
293+ alwaysFetchColumns : linkerAlwaysFetchColumns ,
294+ columnSelectionValidator,
295+ isSelectingColumn,
296+ onColumnSelected,
297+ onDataSelected,
298+ } = useGridLinker ( model , irisGrid ) ;
299+
289300 const [ dehydratedState , setDehydratedState ] = usePersistentState <
290301 ( DehydratedIrisGridState & DehydratedGridState ) | undefined
291302 > ( undefined , { type : 'UITable' , version : 1 } ) ;
@@ -370,8 +381,12 @@ export function UITable({
370381 } , [ format , columns ] ) ;
371382
372383 const alwaysFetchColumnsArray = useMemo (
373- ( ) => [ ...ensureArray ( alwaysFetchColumnsProp ) , ...formatColumnSources ] ,
374- [ alwaysFetchColumnsProp , formatColumnSources ]
384+ ( ) => [
385+ ...ensureArray ( alwaysFetchColumnsProp ) ,
386+ ...formatColumnSources ,
387+ ...linkerAlwaysFetchColumns ,
388+ ] ,
389+ [ alwaysFetchColumnsProp , formatColumnSources , linkerAlwaysFetchColumns ]
375390 ) ;
376391
377392 const alwaysFetchColumns = useMemo ( ( ) => {
@@ -389,10 +404,15 @@ export function UITable({
389404 if ( alwaysFetchColumnsArray [ 0 ] === false ) {
390405 return [ ] ;
391406 }
392- return alwaysFetchColumnsArray . filter (
393- // This v is string can be removed when we're on a newer TS version. 5.7 infers this properly at least
394- ( v ) : v is string => typeof v === 'string'
395- ) ;
407+ return [
408+ // Deduplicate the alwaysFetchColumnsArray
409+ ...new Set (
410+ alwaysFetchColumnsArray . filter (
411+ // This v is string can be removed when we're on a newer TS version. 5.7 infers this properly at least
412+ ( v ) : v is string => typeof v === 'string'
413+ )
414+ ) ,
415+ ] ;
396416 } , [ alwaysFetchColumnsArray , columns , throwError ] ) ;
397417
398418 const mouseHandlers = useMemo (
@@ -529,7 +549,7 @@ export function UITable({
529549 } , [ irisGridServerProps , initialHydratedState ] ) ;
530550
531551 const inputFilters = useDashboardColumnFilters (
532- model ?. columns ?? EMPTY_ARRAY ,
552+ model ?. columns ?? null ,
533553 model ?. table
534554 ) ;
535555
@@ -543,6 +563,10 @@ export function UITable({
543563 ref = { ref => setIrisGrid ( ref ) }
544564 model = { model }
545565 onStateChange = { onStateChange }
566+ columnSelectionValidator = { columnSelectionValidator }
567+ isSelectingColumn = { isSelectingColumn }
568+ onColumnSelected = { onColumnSelected }
569+ onDataSelected = { onDataSelected }
546570 // eslint-disable-next-line react/jsx-props-no-spreading
547571 { ...mergedIrisGridProps }
548572 inputFilters = { inputFilters }
0 commit comments