Skip to content

Commit

Permalink
Fixed #1295
Browse files Browse the repository at this point in the history
  • Loading branch information
Çağatay Çivici committed Nov 16, 2016
1 parent d7edec9 commit 363b349
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions components/datatable/datatable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,8 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni
public rowTouch: boolean;

public editingCell: any;

public filteredByUser: boolean;

differ: any;

Expand All @@ -463,7 +465,7 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni
preventBlurOnEdit: boolean;

columnsSubscription: Subscription;

constructor(public el: ElementRef, public domHandler: DomHandler, differs: IterableDiffers,
public renderer: Renderer, private changeDetector: ChangeDetectorRef) {
this.differ = differs.find([]).create(null);
Expand Down Expand Up @@ -541,6 +543,13 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni
this.updatePaginator();
}

if(this.hasFilter()) {
if(this.filteredByUser)
this.filteredByUser = false;
else
this.filter();
}

if(this.stopSortPropagation) {
this.stopSortPropagation = false;
}
Expand Down Expand Up @@ -993,9 +1002,14 @@ export class DataTable implements AfterViewChecked,AfterViewInit,AfterContentIni
}

this.filterTimeout = setTimeout(() => {
this.filters[field] = {value: value, matchMode: matchMode};
if(value && value.trim().length)
this.filters[field] = {value: value, matchMode: matchMode};
else if(this.filters[field])
delete this.filters[field];

this.filteredByUser = true;
this.filter();
this.filterTimeout = null;
this.filterTimeout = null;
}, this.filterDelay);
}

Expand Down

0 comments on commit 363b349

Please sign in to comment.