@@ -5,13 +5,13 @@ 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 { ColumnContextMenuMixin } from '@ts/grids/grid_core/context_menu/m_column_context_menu_mixin' ;
1211import type { HeaderFilterController } from '@ts/grids/grid_core/header_filter/m_header_filter' ;
1312import type { HeaderPanel } from '@ts/grids/grid_core/header_panel/m_header_panel' ;
1413
14+ import type { Column } from '../columns_controller/m_columns_controller' ;
1515import { CLASSES as REORDERING_CLASSES } from '../columns_resizing_reordering/const' ;
1616import type { HeadersKeyboardNavigationController } from '../keyboard_navigation/m_headers_keyboard_navigation' ;
1717import { registerKeyboardAction } from '../m_accessibility' ;
@@ -467,25 +467,33 @@ export class ColumnHeadersView extends ColumnContextMenuMixin(ColumnsView) {
467467 }
468468
469469 public getColumnElements ( index ?, bandColumnIndex ?) {
470- const that = this ;
471470 let $cellElement ;
472- const columnsController = that . _columnsController ;
473- const rowCount = that . getRowCount ( ) ;
471+ const columnsController = this . _columnsController ;
472+ const rowCount = this . getRowCount ( ) ;
474473
475- if ( that . option ( 'showColumnHeaders' ) ) {
474+ if ( this . option ( 'showColumnHeaders' ) ) {
476475 if ( rowCount > 1 && ( ! isDefined ( index ) || isDefined ( bandColumnIndex ) ) ) {
477476 const result : any [ ] = [ ] ;
478- const visibleColumns = isDefined ( bandColumnIndex ) ? columnsController . getChildrenByBandColumn ( bandColumnIndex , true ) : columnsController . getVisibleColumns ( ) ;
479477
480- each ( visibleColumns , ( _ , column ) => {
481- const rowIndex = isDefined ( index ) ? index : columnsController . getRowIndex ( column . index ) ;
482- $cellElement = that . _getCellElement ( rowIndex , columnsController . getVisibleIndex ( column . index , rowIndex ) ) ;
483- $cellElement && result . push ( $cellElement . get ( 0 ) ) ;
478+ let visibleColumns : Column [ ] = [ ] ;
479+ if ( isDefined ( bandColumnIndex ) ) {
480+ visibleColumns = columnsController . getChildrenByBandColumn ( bandColumnIndex , true ) ;
481+ } else {
482+ visibleColumns = columnsController . getVisibleColumns ( ) ;
483+ }
484+
485+ visibleColumns . forEach ( ( column ) => {
486+ const rowIndex = index ?? columnsController . getRowIndex ( column . index ) ;
487+ const visibleIndex = columnsController . getVisibleIndex ( column . index , rowIndex ) ;
488+ $cellElement = this . _getCellElement ( rowIndex , visibleIndex ) ;
489+ if ( $cellElement ) {
490+ result . push ( $cellElement . get ( 0 ) ) ;
491+ }
484492 } ) ;
485493
486494 return $ ( result ) ;
487495 } if ( ! index || index < rowCount ) {
488- return that . getCellElements ( index || 0 ) ;
496+ return this . getCellElements ( index || 0 ) ;
489497 }
490498 }
491499
0 commit comments