Skip to content

Commit

Permalink
fix(grid): mark grid for check inside NgZone when resizing #2792
Browse files Browse the repository at this point in the history
  • Loading branch information
SAndreeva committed Dec 3, 2018
1 parent a09a3b6 commit 08962fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Injectable } from '@angular/core';
import { Injectable, NgZone } from '@angular/core';
import { isFirefox } from '../core/utils';
import { IgxColumnComponent } from './column.component';

Expand Down Expand Up @@ -37,6 +37,8 @@ export class IgxColumnResizingService {
*/
public column: IgxColumnComponent;

constructor(private zone: NgZone) { }


/**
* Returns the minimal possible width to which the column can be resized.
Expand Down Expand Up @@ -104,7 +106,9 @@ export class IgxColumnResizingService {
this.column.width = size;
}

this.column.grid.markForCheck();

this.zone.run(() => this.column.grid.markForCheck());

this.column.grid.reflow();
this.column.grid.onColumnResized.emit({
column: this.column,
Expand Down Expand Up @@ -145,7 +149,7 @@ export class IgxColumnResizingService {
this.column.width = (currentColWidth + diff) + 'px';
}

this.column.grid.markForCheck();
this.zone.run(() => this.column.grid.markForCheck());
this.column.grid.reflow();

if (currentColWidth !== parseFloat(this.column.width)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { IgxColumnResizingService } from './grid-column-resizing.service';
selector: 'igx-grid-header',
templateUrl: './grid-header.component.html'
})
export class IgxGridHeaderComponent implements OnInit, DoCheck {
export class IgxGridHeaderComponent implements DoCheck {

@Input()
public column: IgxColumnComponent;
Expand Down Expand Up @@ -113,10 +113,6 @@ export class IgxGridHeaderComponent implements OnInit, DoCheck {
public filteringService: IgxFilteringService
) { }

public ngOnInit() {
this.column.columnGroup ? this.zone.runTask(() => this.cdr.markForCheck()) :
this.cdr.markForCheck();
}

public ngDoCheck() {
this.getSortDirection();
Expand Down

0 comments on commit 08962fe

Please sign in to comment.