I have a dataset that looks like this:
[
{
"name": "Item1",
"section": "section1",
"total": 3,
}, {
"name": "Item1",
"section": "section2",
"total": 4,
}{
"name": "Item1",
"section": "section3",
"total": 7,
}, {
"name": "Item2",
"section": "section1",
"total": 1,
}, {
"name": "Item2",
"section": "section2",
"total": 2,
}, {
"name": "Item2",
"section": "section3",
"total": 3,
}
]
I need to sort the array by only the total value in the section 3 item, but maintain the order (section1, section2, then section 3) per name. So for this example Item2 should move all 3 of it's rows above Item1. I've tried sorting by multiple items, but that doesn't maintain the ordering that I need. Should I just get the smallest/biggest, grab the related items and put them into a new array and repeat or is there a more logical way to accomplish this?
I'm also using angular and primeng grid if there's something I can leverage in there.