@@ -890,7 +890,10 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
890890 this . _isLoading = value ;
891891 this . evaluateLoadingState ( ) ;
892892 }
893- this . notifyChanges ( ) ;
893+ Promise . resolve ( ) . then ( ( ) => {
894+ // wait for the current detection cycle to end before triggering a new one.
895+ this . notifyChanges ( ) ;
896+ } ) ;
894897 }
895898
896899 /**
@@ -4630,8 +4633,8 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
46304633 public hasVerticalSroll ( ) {
46314634 if ( this . _init ) { return false ; }
46324635 const isScrollable = this . verticalScrollContainer ? this . verticalScrollContainer . isScrollable ( ) : false ;
4633- return ! ! ( this . calcWidth && this . verticalScrollContainer . igxForOf &&
4634- this . verticalScrollContainer . igxForOf . length > 0 &&
4636+ return ! ! ( this . calcWidth && this . dataView &&
4637+ this . dataView . length > 0 &&
46354638 isScrollable ) ;
46364639 }
46374640
@@ -4997,6 +5000,17 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
49975000 return 0 ;
49985001 }
49995002
5003+ /**
5004+ * Returns the currently transformed paged/filtered/sorted/grouped data, displayed in the grid.
5005+ * ```typescript
5006+ * const dataView = this.grid.dataView;
5007+ * ```
5008+ * @memberof IgxGridComponent
5009+ */
5010+ get dataView ( ) : any [ ] {
5011+ return this . verticalScrollContainer . igxForOf ;
5012+ }
5013+
50005014 /**
50015015 * Get current selection state.
50025016 * Returns an array with selected rows' IDs (primaryKey or rowData)
@@ -5215,7 +5229,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
52155229 * If `headers` is enabled, it will use the column header (if any) instead of the column field.
52165230 */
52175231 getSelectedData ( formatters = false , headers = false ) {
5218- const source = this . verticalScrollContainer . igxForOf ;
5232+ const source = this . dataView ;
52195233 return this . extractDataFromSelection ( source , formatters , headers ) ;
52205234 }
52215235
@@ -5284,12 +5298,12 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
52845298 * @memberof IgxGridBaseComponent
52855299 */
52865300 public navigateTo ( rowIndex : number , visibleColIndex = - 1 , cb : Function = null ) {
5287- if ( rowIndex < 0 || rowIndex > this . verticalScrollContainer . igxForOf . length - 1
5301+ if ( rowIndex < 0 || rowIndex > this . dataView . length - 1
52885302 || ( visibleColIndex !== - 1 && this . columnList . map ( col => col . visibleIndex ) . indexOf ( visibleColIndex ) === - 1 ) ) {
52895303 return ;
52905304 }
52915305 this . wheelHandler ( ) ;
5292- if ( this . verticalScrollContainer . igxForOf . slice ( rowIndex , rowIndex + 1 ) . find ( rec => rec . expression || rec . childGridsData ) ) {
5306+ if ( this . dataView . slice ( rowIndex , rowIndex + 1 ) . find ( rec => rec . expression || rec . childGridsData ) ) {
52935307 visibleColIndex = - 1 ;
52945308 }
52955309 if ( visibleColIndex === - 1 || this . navigation . isColumnFullyVisible ( visibleColIndex ) ) {
@@ -5325,7 +5339,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
53255339 const colIndexes = callback ? columns . filter ( ( col ) => callback ( col ) ) . map ( editCol => editCol . visibleIndex ) . sort ( ( a , b ) => a - b ) :
53265340 columns . map ( editCol => editCol . visibleIndex ) . sort ( ( a , b ) => a - b ) ;
53275341 const nextCellIndex = colIndexes . find ( index => index > curVisibleColIndex ) ;
5328- if ( this . verticalScrollContainer . igxForOf . slice ( currRowIndex , currRowIndex + 1 )
5342+ if ( this . dataView . slice ( currRowIndex , currRowIndex + 1 )
53295343 . find ( rec => ! rec . expression && ! rec . summaries && ! rec . childGridsData ) && nextCellIndex !== undefined ) {
53305344 return { rowIndex : currRowIndex , visibleColumnIndex : nextCellIndex } ;
53315345 } else {
@@ -5357,7 +5371,7 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
53575371 const colIndexes = callback ? columns . filter ( ( col ) => callback ( col ) ) . map ( editCol => editCol . visibleIndex ) . sort ( ( a , b ) => b - a ) :
53585372 columns . map ( editCol => editCol . visibleIndex ) . sort ( ( a , b ) => b - a ) ;
53595373 const prevCellIndex = colIndexes . find ( index => index < curVisibleColIndex ) ;
5360- if ( this . verticalScrollContainer . igxForOf . slice ( currRowIndex , currRowIndex + 1 )
5374+ if ( this . dataView . slice ( currRowIndex , currRowIndex + 1 )
53615375 . find ( rec => ! rec . expression && ! rec . summaries && ! rec . childGridsData ) && prevCellIndex !== undefined ) {
53625376 return { rowIndex : currRowIndex , visibleColumnIndex : prevCellIndex } ;
53635377 } else {
@@ -5400,24 +5414,24 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
54005414 private getPrevDataRowIndex ( currentRowIndex ) : number {
54015415 if ( currentRowIndex <= 0 ) { return currentRowIndex ; }
54025416
5403- const prevRow = this . verticalScrollContainer . igxForOf . slice ( 0 , currentRowIndex ) . reverse ( )
5417+ const prevRow = this . dataView . slice ( 0 , currentRowIndex ) . reverse ( )
54045418 . find ( rec => ! rec . expression && ! rec . summaries && ! rec . childGridsData ) ;
5405- return prevRow ? this . verticalScrollContainer . igxForOf . indexOf ( prevRow ) : currentRowIndex ;
5419+ return prevRow ? this . dataView . indexOf ( prevRow ) : currentRowIndex ;
54065420 }
54075421
54085422 private getNextDataRowIndex ( currentRowIndex ) : number {
5409- if ( currentRowIndex === this . verticalScrollContainer . igxForOf . length ) { return currentRowIndex ; }
5423+ if ( currentRowIndex === this . dataView . length ) { return currentRowIndex ; }
54105424
5411- const nextRow = this . verticalScrollContainer . igxForOf . slice ( currentRowIndex + 1 , this . verticalScrollContainer . igxForOf . length )
5425+ const nextRow = this . dataView . slice ( currentRowIndex + 1 , this . dataView . length )
54125426 . find ( rec => ! rec . expression && ! rec . summaries && ! rec . childGridsData ) ;
5413- return nextRow ? this . verticalScrollContainer . igxForOf . indexOf ( nextRow ) : currentRowIndex ;
5427+ return nextRow ? this . dataView . indexOf ( nextRow ) : currentRowIndex ;
54145428 }
54155429
54165430 private isValidPosition ( rowIndex , colIndex ) : boolean {
54175431 const rows = this . summariesRowList . filter ( s => s . index !== 0 ) . concat ( this . rowList . toArray ( ) ) . length ;
54185432 const cols = this . columnList . filter ( col => ! col . columnGroup && col . visibleIndex >= 0 ) . length ;
54195433 if ( rows < 1 || cols < 1 ) { return false ; }
5420- if ( rowIndex > - 1 && rowIndex < this . verticalScrollContainer . igxForOf . length &&
5434+ if ( rowIndex > - 1 && rowIndex < this . dataView . length &&
54215435 colIndex > - 1 && colIndex <= this . unpinnedColumns [ this . unpinnedColumns . length - 1 ] . visibleIndex ) {
54225436 return true ;
54235437 }
@@ -5614,11 +5628,11 @@ export abstract class IgxGridBaseComponent extends DisplayDensityBase implements
56145628 if ( delayScrolling ) {
56155629 this . verticalScrollContainer . onDataChanged . pipe ( first ( ) ) . subscribe ( ( ) => {
56165630 this . scrollDirective ( this . verticalScrollContainer ,
5617- typeof ( row ) === 'number' ? row : this . verticalScrollContainer . igxForOf . indexOf ( row ) ) ;
5631+ typeof ( row ) === 'number' ? row : this . dataView . indexOf ( row ) ) ;
56185632 } ) ;
56195633 } else {
56205634 this . scrollDirective ( this . verticalScrollContainer ,
5621- typeof ( row ) === 'number' ? row : this . verticalScrollContainer . igxForOf . indexOf ( row ) ) ;
5635+ typeof ( row ) === 'number' ? row : this . dataView . indexOf ( row ) ) ;
56225636 }
56235637
56245638 this . scrollToHorizontally ( column ) ;
0 commit comments