11import CellRowModel from './CellRowModel.mjs' ;
2- import ColumnModel from './ColumnModel.mjs' ;
32import VDomUtil from '../../util/VDom.mjs' ;
43
54/**
@@ -54,14 +53,15 @@ class CellColumnRowModel extends CellRowModel {
5453 * @param {Object } data
5554 */
5655 onCellClick ( data ) {
57- let me = this ,
58- { headerToolbar } = me . view . parent ,
59- id = data . data . currentTarget ,
60- columnNodeIds , index ;
56+ let me = this ,
57+ { view } = me ,
58+ cellId = data . data . currentTarget ,
59+ columnNodeIds , dataField , index ;
6160
62- if ( id ) {
63- index = ColumnModel . getColumnIndex ( id , headerToolbar . items ) ;
64- columnNodeIds = VDomUtil . getColumnNodesIds ( me . view . vdom , index ) ;
61+ if ( cellId ) {
62+ dataField = view . getDataField ( cellId ) ;
63+ index = view . getColumn ( dataField , true ) ;
64+ columnNodeIds = VDomUtil . getColumnNodesIds ( view . vdom , index ) ;
6565
6666 me . deselectAllCells ( true ) ;
6767 me . select ( columnNodeIds , me . selectedColumnCellIds , me . selectedColumnCellCls )
@@ -71,29 +71,31 @@ class CellColumnRowModel extends CellRowModel {
7171 }
7272
7373 /**
74- * @param {Object } data
7574 * @param {Number } step
7675 */
77- onNavKeyColumn ( data , step ) {
78- let me = this ,
79- idArray = ColumnModel . getCellId ( data . path ) . split ( '__' ) ,
80- currentColumn = idArray [ 2 ] ,
81- { view} = me ,
82- dataFields = view . parent . columns . map ( c => c . dataField ) ,
83- newIndex = ( dataFields . indexOf ( currentColumn ) + step ) % dataFields . length ,
84- columnNodeIds , tbodyNode ;
85-
86- while ( newIndex < 0 ) {
87- newIndex += dataFields . length
76+ onNavKeyColumn ( step ) {
77+ let me = this ,
78+ { dataFields, view} = me ,
79+ columnNodeIds , currentColumn , index ;
80+
81+ if ( me . hasSelection ( ) ) {
82+ currentColumn = view . getDataField ( me . items [ 0 ] )
83+ } else {
84+ currentColumn = dataFields [ 0 ]
85+ }
86+
87+ index = ( dataFields . indexOf ( currentColumn ) + step ) % dataFields . length ;
88+
89+ while ( index < 0 ) {
90+ index += dataFields . length
8891 }
8992
90- tbodyNode = VDomUtil . find ( me . view . vdom , { tag : 'tbody' } ) . vdom ;
91- columnNodeIds = VDomUtil . getColumnNodesIds ( tbodyNode , newIndex ) ;
93+ columnNodeIds = VDomUtil . getColumnNodesIds ( view . vdom , index ) ;
9294
9395 me . deselectAllCells ( true ) ;
9496 me . select ( columnNodeIds , me . selectedColumnCellIds , me . selectedColumnCellCls ) ;
9597
96- super . onNavKeyColumn ( data , step )
98+ super . onNavKeyColumn ( step )
9799 }
98100
99101 /**
0 commit comments