default sorter will now use dotNotation
This commit is contained in:
parent
feda2b6c53
commit
d544581b0e
@ -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": {
|
||||||
|
@ -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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user