Skip to content

Commit

Permalink
feat(filter): add a check for existing filters
Browse files Browse the repository at this point in the history
  • Loading branch information
geneeblack authored and lexzhukov committed Mar 29, 2017
1 parent ebfbd54 commit 8daa70f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ng2-smart-table/components/filter/filter.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ export class FilterComponent implements AfterViewInit {
if (filterConf && filterConf.filters && filterConf.filters.length === 0) {
this.query = '';
}
// add a check for existing filters an set the query if one exists for this column
// this covers instances where the filter is set by user code while maintaining existing functionality
else if (filterConf && filterConf.filters && filterConf.filters.length > 0) {
for (var key in filterConf.filters)
{
if (filterConf.filters[key]['field'] == _this.column['id'])
_this.query = filterConf.filters[key]['search'];
}
}
});
}

Expand Down

0 comments on commit 8daa70f

Please sign in to comment.