@@ -4237,7 +4237,7 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
4237
4237
* @hidden
4238
4238
* @internal
4239
4239
*/
4240
- protected _getResolvedDataIndex ( index : number ) : number {
4240
+ protected _getDataViewIndex ( index : number ) : number {
4241
4241
let newIndex = index ;
4242
4242
if ( ( index < 0 || index >= this . dataView . length ) && this . pagingMode === 1 && this . paginator . page !== 0 ) {
4243
4243
newIndex = index - this . paginator . perPage * this . paginator . page ;
@@ -4247,6 +4247,18 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
4247
4247
return newIndex ;
4248
4248
}
4249
4249
4250
+ /**
4251
+ * @hidden
4252
+ * @internal
4253
+ */
4254
+ protected getDataIndex ( dataViewIndex : number ) : number {
4255
+ let newIndex = dataViewIndex ;
4256
+ if ( this . gridAPI . grid . verticalScrollContainer . isRemote ) {
4257
+ newIndex = dataViewIndex + this . gridAPI . grid . virtualizationState . startIndex ;
4258
+ }
4259
+ return newIndex ;
4260
+ }
4261
+
4250
4262
/**
4251
4263
* Places a column before or after the specified target column.
4252
4264
*
@@ -5697,21 +5709,22 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
5697
5709
public getNextCell ( currRowIndex : number , curVisibleColIndex : number ,
5698
5710
callback : ( IgxColumnComponent ) => boolean = null ) : ICellPosition {
5699
5711
const columns = this . columnList . filter ( col => ! col . columnGroup && col . visibleIndex >= 0 ) ;
5700
-
5701
- if ( ! this . isValidPosition ( currRowIndex , curVisibleColIndex ) ) {
5712
+ const dataViewIndex = this . _getDataViewIndex ( currRowIndex ) ;
5713
+ if ( ! this . isValidPosition ( dataViewIndex , curVisibleColIndex ) ) {
5702
5714
return { rowIndex : currRowIndex , visibleColumnIndex : curVisibleColIndex } ;
5703
5715
}
5704
5716
const colIndexes = callback ? columns . filter ( ( col ) => callback ( col ) ) . map ( editCol => editCol . visibleIndex ) . sort ( ( a , b ) => a - b ) :
5705
5717
columns . map ( editCol => editCol . visibleIndex ) . sort ( ( a , b ) => a - b ) ;
5706
5718
const nextCellIndex = colIndexes . find ( index => index > curVisibleColIndex ) ;
5707
- if ( this . dataView . slice ( currRowIndex , currRowIndex + 1 )
5719
+ if ( this . dataView . slice ( dataViewIndex , dataViewIndex + 1 )
5708
5720
. find ( rec => ! rec . expression && ! rec . summaries && ! rec . childGridsData && ! rec . detailsData ) && nextCellIndex !== undefined ) {
5709
5721
return { rowIndex : currRowIndex , visibleColumnIndex : nextCellIndex } ;
5710
5722
} else {
5711
- if ( colIndexes . length === 0 || this . getNextDataRowIndex ( currRowIndex ) === currRowIndex ) {
5723
+ const nextIndex = this . getNextDataRowIndex ( currRowIndex )
5724
+ if ( colIndexes . length === 0 || nextIndex === currRowIndex ) {
5712
5725
return { rowIndex : currRowIndex , visibleColumnIndex : curVisibleColIndex } ;
5713
5726
} else {
5714
- return { rowIndex : this . getNextDataRowIndex ( currRowIndex ) , visibleColumnIndex : colIndexes [ 0 ] } ;
5727
+ return { rowIndex : nextIndex , visibleColumnIndex : colIndexes [ 0 ] } ;
5715
5728
}
5716
5729
}
5717
5730
}
@@ -5731,21 +5744,22 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
5731
5744
public getPreviousCell ( currRowIndex : number , curVisibleColIndex : number ,
5732
5745
callback : ( IgxColumnComponent ) => boolean = null ) : ICellPosition {
5733
5746
const columns = this . columnList . filter ( col => ! col . columnGroup && col . visibleIndex >= 0 ) ;
5734
-
5735
- if ( ! this . isValidPosition ( currRowIndex , curVisibleColIndex ) ) {
5747
+ const dataViewIndex = this . _getDataViewIndex ( currRowIndex ) ;
5748
+ if ( ! this . isValidPosition ( dataViewIndex , curVisibleColIndex ) ) {
5736
5749
return { rowIndex : currRowIndex , visibleColumnIndex : curVisibleColIndex } ;
5737
5750
}
5738
5751
const colIndexes = callback ? columns . filter ( ( col ) => callback ( col ) ) . map ( editCol => editCol . visibleIndex ) . sort ( ( a , b ) => b - a ) :
5739
5752
columns . map ( editCol => editCol . visibleIndex ) . sort ( ( a , b ) => b - a ) ;
5740
5753
const prevCellIndex = colIndexes . find ( index => index < curVisibleColIndex ) ;
5741
- if ( this . dataView . slice ( currRowIndex , currRowIndex + 1 )
5754
+ if ( this . dataView . slice ( dataViewIndex , dataViewIndex + 1 )
5742
5755
. find ( rec => ! rec . expression && ! rec . summaries && ! rec . childGridsData && ! rec . detailsData ) && prevCellIndex !== undefined ) {
5743
5756
return { rowIndex : currRowIndex , visibleColumnIndex : prevCellIndex } ;
5744
5757
} else {
5745
- if ( colIndexes . length === 0 || this . getNextDataRowIndex ( currRowIndex , true ) === currRowIndex ) {
5758
+ const prevIndex = this . getNextDataRowIndex ( currRowIndex , true ) ;
5759
+ if ( colIndexes . length === 0 || prevIndex === currRowIndex ) {
5746
5760
return { rowIndex : currRowIndex , visibleColumnIndex : curVisibleColIndex } ;
5747
5761
} else {
5748
- return { rowIndex : this . getNextDataRowIndex ( currRowIndex , true ) , visibleColumnIndex : colIndexes [ 0 ] } ;
5762
+ return { rowIndex : prevIndex , visibleColumnIndex : colIndexes [ 0 ] } ;
5749
5763
}
5750
5764
}
5751
5765
}
@@ -7148,8 +7162,8 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
7148
7162
cb ( cbArgs ) ;
7149
7163
} ) ;
7150
7164
}
7151
-
7152
- if ( this . dataView [ rowIndex ] . detailsData ) {
7165
+ const dataViewIndex = this . _getDataViewIndex ( rowIndex ) ;
7166
+ if ( this . dataView [ dataViewIndex ] . detailsData ) {
7153
7167
this . navigation . setActiveNode ( { row : rowIndex } ) ;
7154
7168
this . cdr . detectChanges ( ) ;
7155
7169
}
@@ -7185,14 +7199,16 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
7185
7199
}
7186
7200
7187
7201
private getNextDataRowIndex ( currentRowIndex , previous = false ) : number {
7188
- if ( currentRowIndex < 0 || ( currentRowIndex === 0 && previous ) || ( currentRowIndex >= this . dataView . length - 1 && ! previous ) ) {
7202
+ const resolvedIndex = this . _getDataViewIndex ( currentRowIndex ) ;
7203
+ if ( currentRowIndex < 0 || ( currentRowIndex === 0 && previous ) || ( resolvedIndex >= this . dataView . length - 1 && ! previous ) ) {
7189
7204
return currentRowIndex ;
7190
7205
}
7191
7206
// find next/prev record that is editable.
7192
7207
const nextRowIndex = previous ? this . findPrevEditableDataRowIndex ( currentRowIndex ) :
7193
7208
this . dataView . findIndex ( ( rec , index ) =>
7194
- index > currentRowIndex && this . isEditableDataRecordAtIndex ( index ) ) ;
7195
- return nextRowIndex !== - 1 ? nextRowIndex : currentRowIndex ;
7209
+ index > resolvedIndex && this . isEditableDataRecordAtIndex ( index ) ) ;
7210
+ const nextDataIndex = this . getDataIndex ( nextRowIndex ) ;
7211
+ return nextDataIndex !== - 1 ? nextDataIndex : currentRowIndex ;
7196
7212
}
7197
7213
7198
7214
/**
@@ -7202,8 +7218,9 @@ export abstract class IgxGridBaseDirective extends DisplayDensityBase implements
7202
7218
*/
7203
7219
private findPrevEditableDataRowIndex ( currentIndex ) : number {
7204
7220
let i = this . dataView . length ;
7221
+ const resolvedIndex = this . _getDataViewIndex ( currentIndex ) ;
7205
7222
while ( i -- ) {
7206
- if ( i < currentIndex && this . isEditableDataRecordAtIndex ( i ) ) {
7223
+ if ( i < resolvedIndex && this . isEditableDataRecordAtIndex ( i ) ) {
7207
7224
return i ;
7208
7225
}
7209
7226
}
0 commit comments