@@ -78,6 +78,7 @@ import {
7878 TableColumnFormat ,
7979 Settings ,
8080 isSortDirection ,
81+ type SortDescriptor ,
8182} from '@deephaven/jsapi-utils' ;
8283import {
8384 assertNotNull ,
@@ -231,7 +232,7 @@ function isEmptyConfig({
231232 rollupConfig ?: UIRollupConfig ;
232233 searchFilter ?: DhType . FilterCondition ;
233234 selectDistinctColumns : readonly ColumnName [ ] ;
234- sorts : readonly DhType . Sort [ ] ;
235+ sorts : readonly SortDescriptor [ ] ;
235236} ) : boolean {
236237 return (
237238 advancedFilters . size === 0 &&
@@ -305,7 +306,7 @@ export interface IrisGridProps {
305306 /** @deprecated use `partitionConfig` instead */
306307 partitions ?: ( string | null ) [ ] ;
307308 partitionConfig ?: PartitionConfig ;
308- sorts : readonly DhType . Sort [ ] ;
309+ sorts : readonly SortDescriptor [ ] ;
309310
310311 /** @deprecated use `reverse` instead */
311312 reverseType ?: ReverseType ;
@@ -389,7 +390,7 @@ export interface IrisGridState {
389390 shownAdvancedFilter : number | null ;
390391 hoverAdvancedFilter : number | null ;
391392
392- sorts : readonly DhType . Sort [ ] ;
393+ sorts : readonly SortDescriptor [ ] ;
393394 reverse : boolean ;
394395 customColumns : readonly ColumnName [ ] ;
395396 selectDistinctColumns : readonly ColumnName [ ] ;
@@ -1388,7 +1389,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
13881389 loadingScrimProgress : number | null ,
13891390 quickFilters : ReadonlyQuickFilterMap ,
13901391 advancedFilters : ReadonlyAdvancedFilterMap ,
1391- sorts : readonly DhType . Sort [ ] ,
1392+ sorts : readonly SortDescriptor [ ] ,
13921393 reverse : boolean ,
13931394 rollupConfig : UIRollupConfig | undefined ,
13941395 isMenuShown : boolean
@@ -1548,6 +1549,11 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
15481549 return '' ;
15491550 }
15501551
1552+ /**
1553+ * Get the model column index for the provided visible index
1554+ * @param columnIndex Visible column index
1555+ * @returns Model column index, or null if not found
1556+ */
15511557 getModelColumn ( columnIndex : GridRangeIndex ) : ModelIndex | null | undefined {
15521558 const { metrics } = this . state ;
15531559 assertNotNull ( metrics ) ;
@@ -1556,6 +1562,11 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
15561562 return null ;
15571563 }
15581564
1565+ if ( columnIndex != null && columnIndex < 0 ) {
1566+ // ColumnBy sources aren't movable, so just return the index directly
1567+ return columnIndex ;
1568+ }
1569+
15591570 return columnIndex != null ? modelColumns . get ( columnIndex ) : null ;
15601571 }
15611572
@@ -2767,7 +2778,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
27672778 }
27682779 }
27692780
2770- updateSorts ( sorts : readonly DhType . Sort [ ] ) : void {
2781+ updateSorts ( sorts : readonly SortDescriptor [ ] ) : void {
27712782 this . startLoading ( 'Sorting...' ) ;
27722783 this . setState ( { sorts } ) ;
27732784 this . grid ?. forceUpdate ( ) ;
0 commit comments