default sorter will now use dotNotation

This commit is contained in:
Zakary Timson 2018-06-28 18:59:36 -04:00
parent feda2b6c53
commit d544581b0e
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@ztimson/ng-datatable", "name": "@ztimson/ng-datatable",
"version": "1.6.7", "version": "1.6.8",
"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

@ -67,8 +67,8 @@ export class NgDatatableComponent implements OnInit {
this.processedData = this.processedData.sort(this.columns[this.sortedColumn].sortFn); this.processedData = this.processedData.sort(this.columns[this.sortedColumn].sortFn);
} else { } else {
this.processedData = this.processedData.sort((a: any, b: any) => { this.processedData = this.processedData.sort((a: any, b: any) => {
if (a[this.columns[this.sortedColumn].property] > b[this.columns[this.sortedColumn].property]) return 1; if (this._dotNotation(a, this.columns[this.sortedColumn].property) > this._dotNotation(b, this.columns[this.sortedColumn].property)) return 1;
if (a[this.columns[this.sortedColumn].property] < b[this.columns[this.sortedColumn].property]) return -1; if (this._dotNotation(a, this.columns[this.sortedColumn].property) < this._dotNotation(b, this.columns[this.sortedColumn].property)) return -1;
return 0; return 0;
}); });
} }