Fixed initial sort happening too soon

This commit is contained in:
Zakary Timson 2018-06-27 14:05:14 -04:00
parent dc6ee49467
commit 0fb93f723e
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@ztimson/ng-datatable", "name": "@ztimson/ng-datatable",
"version": "1.6.5", "version": "1.6.6",
"homepage": "https://github.com/ztimson/ng-datatable", "homepage": "https://github.com/ztimson/ng-datatable",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": { "author": {

View File

@ -62,7 +62,7 @@ export class NgDatatableComponent implements OnInit {
this.clearSelected(); this.clearSelected();
this.processedData = this._data; this.processedData = this._data;
this.filters.forEach(f => this.processedData = this.processedData.filter(f)); this.filters.forEach(f => this.processedData = this.processedData.filter(f));
if(this.sortedColumn != null) { if(this.sortedColumn != null && this.processedData) {
if (this.columns[this.sortedColumn].sortFn) { if (this.columns[this.sortedColumn].sortFn) {
this.processedData = this.processedData.sort(this.columns[this.sortedColumn].sortFn); this.processedData = this.processedData.sort(this.columns[this.sortedColumn].sortFn);
} else { } else {