Closed SrideviYerneni closed 5 years ago
I think I might have an answer for this. It's little bit tricky.
Given:
const collection = [
{
"name": "Mark",
"age" : "25"
},
{
"name": "Peter",
"age" : "25"
},
{
"name": "John ",
"age" : "25"
}
];
So if you sort collection
by name
you'll get: John
, Mark
, Peter
.
And then if you sort by age
you'll get: Mark
, Peter
, John
and not John
, Mark
, Peter
! The reason for that is that instead of taking last result (which is sorted asJohn
, Mark
, Peter
) pipe will take original array (collection
, which is sorted as Mark
, Peter
, John
).
Hope that is clear.
Hi. When I apply sorting to the table, if the column has all same values, and when I click on the column to sort, nothing should happen. But it is sorting other columns when I'm clicking on the columns with same values. Here's the collection :
html:
component.ts