I want to sort Below array based on name
and is_closed
.
this.rawDataListDup = [
{id: 1, name: 'john','is_closed':true},
{id: 2, name: 'james','is_closed':true},
{id: 3, name: 'jane','is_closed':false},
{id: 4, name: 'alex','is_closed':false},
{id: 5, name: 'david','is_closed':true},
];
As of now i can only sort using any one of the attribute using below code.
let colName = 'name'
this.rawDataListDup.sort((b, a) => a[colName] < b[colName] ? 1 : a[colName] > b[colName] ? -1 : 0)
I want array objects with is_closed = false
on top of array and also it should be in Alphabetical order
. like this
this.rawDataListDup = [
{id: 4, name: 'alex','is_closed':false},
{id: 3, name: 'jane','is_closed':false},
{id: 5, name: 'david','is_closed':true},
{id: 2, name: 'james','is_closed':true},
{id: 1, name: 'john','is_closed':true},
];
how to do this?