I have searched but I can't quite find a JavaScript/jQuery solution. I have an array of objects like this
MLDS = [
{"Group": "Red","Level": "Level 2"},
{"Group": "Green","Level": "Level 1"},
{"Group": "Red","Level": "Level 1"},
{"Group": "Blue","Level": "Level 1"},
{"Group": "Green","Level": "Level 2"},
{"Group": "Yellow","Level": "Level 1"}
]
I want to be able to reorganize on Group and within the Group sort on Level to return another array of the objects in that new order so
MLDS = [
{"Group": "Red","Level": "Level 1"},
{"Group": "Red","Level": "Level 2"},
{"Group": "Green","Level": "Level 1"},
{"Group": "Green","Level": "Level 2"},
{"Group": "Blue","Level": "Level 1"},
{"Group": "Yellow","Level": "Level 1"}
]
I need to be able to keep the Group in the order in which they first appear so I need, in this case to maintain the group order of Red, Green, Blue then yellow, but sort within those groups