1
我已經搜索過但我找不到JavaScript/jQuery解決方案。 我有對象的這樣在javascript對象數組中進行排序和排序
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"}
]
我希望能夠重組的集團與等級對應的組排序中返回的對象的另一個數組中的新秩序陣列,使得
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"}
]
我需要能夠保持組的順序,他們第一次出現,所以我需要,在這種情況下,維持紅色,綠色,藍色然後黃組排序,但排序在這些組
完美。正是我想要的 –