I have this data which i’m displaying in the table
[
{
"ID": 9,
"Status": "Pending",
},
{
"ID": 8,
"Status": null,
},
{
"ID": 7,
"Status": "Pending",
},
{
"ID": 10,
"Status": null,
},
{
"ID": 18,
"Status": "Completed",
},
{
"ID": 17,
"Status": "In Progress",
}
]
Sort Method:
Ascending order :
this.List.sort((a, b) => a[columnname] < b[columnname] ? 1 : a[columnname] > b[columnname]` ? -1 : 0);
Descending order :
this.List.sort((a, b) => a[columnname] > b[columnname] ? 1 : a[columnname] < b[columnname] ? -1 : 0);
and using sort function to sort the data in table issue is when i sort it, i want to place null values at the last.