@@ -5,12 +5,12 @@ import type { dxElementWrapper } from '@js/core/renderer';
55import $ from '@js/core/renderer' ;
66import { Deferred } from '@js/core/utils/deferred' ;
77import { extend } from '@js/core/utils/extend' ;
8- import { each } from '@js/core/utils/iterator' ;
98import { getHeight } from '@js/core/utils/size' ;
109import { isDefined } from '@js/core/utils/type' ;
1110import type { HeaderFilterController } from '@ts/grids/grid_core/header_filter/m_header_filter' ;
1211import type { HeaderPanel } from '@ts/grids/grid_core/header_panel/m_header_panel' ;
1312
13+ import type { Column } from '../columns_controller/m_columns_controller' ;
1414import { CLASSES as REORDERING_CLASSES } from '../columns_resizing_reordering/const' ;
1515import { registerKeyboardAction } from '../m_accessibility' ;
1616import { ColumnsView } from '../views/m_columns_view' ;
@@ -458,26 +458,34 @@ export class ColumnHeadersView extends ColumnsView {
458458 }
459459
460460 public getColumnElements ( index ?, bandColumnIndex ?) {
461- const that = this ;
462461 let $cellElement ;
463- const columnsController = that . _columnsController ;
464- const rowCount = that . getRowCount ( ) ;
462+ const columnsController = this . _columnsController ;
463+ const rowCount = this . getRowCount ( ) ;
465464
466- if ( that . option ( 'showColumnHeaders' ) ) {
465+ if ( this . option ( 'showColumnHeaders' ) ) {
467466 if ( rowCount > 1 && ( ! isDefined ( index ) || isDefined ( bandColumnIndex ) ) ) {
468467 const result : any [ ] = [ ] ;
469- const visibleColumns = isDefined ( bandColumnIndex ) ? columnsController . getChildrenByBandColumn ( bandColumnIndex , true ) : columnsController . getVisibleColumns ( ) ;
470468
471- each ( visibleColumns , ( _ , column ) => {
472- const rowIndex = isDefined ( index ) ? index : columnsController . getRowIndex ( column . index ) ;
473- $cellElement = that . _getCellElement ( rowIndex , columnsController . getVisibleIndex ( column . index , rowIndex ) ) ;
474- $cellElement && result . push ( $cellElement . get ( 0 ) ) ;
469+ let visibleColumns : Column [ ] = [ ] ;
470+ if ( isDefined ( bandColumnIndex ) ) {
471+ visibleColumns = columnsController . getChildrenByBandColumn ( bandColumnIndex , true ) ;
472+ } else {
473+ visibleColumns = columnsController . getVisibleColumns ( ) ;
474+ }
475+
476+ visibleColumns . forEach ( ( column ) => {
477+ const rowIndex = index ?? columnsController . getRowIndex ( column . index ) ;
478+ const visibleIndex = columnsController . getVisibleIndex ( column . index , rowIndex ) ;
479+ $cellElement = this . _getCellElement ( rowIndex , visibleIndex ) ;
480+ if ( $cellElement ) {
481+ result . push ( $cellElement . get ( 0 ) ) ;
482+ }
475483 } ) ;
476484
477485 // @ts -expect-error
478486 return $ ( result ) ;
479487 } if ( ! index || index < rowCount ) {
480- return that . getCellElements ( index || 0 ) ;
488+ return this . getCellElements ( index || 0 ) ;
481489 }
482490 }
483491
0 commit comments