I need to sort an array of objects by columnId, preferably using lodash. The array is like this:
lines: lineId: 1,lineAbbreviation: "",workingListId: 4208,workingListType: 0,sortOrder: 0,holdType: 1,[tripSummary: - [- {columnId: 24,columnType: 1,value: "2.00"},- {columnId: 28,columnType: 5,value: "0.66"},- {columnId: 29,columnType: 6,value: "0.00"},- {columnId: 23,columnType: 0,value: "152.56"},- {columnId: 25,columnType: 2,value: "24"},- {columnId: 26,columnType: 3,value: "30"},- {columnId: 27,columnType: 4,value: "101.36"},- {columnId: 30,columnType: 7,value: "0.00"},- {columnId: 31,columnType: 8,value: "0.5"},- {columnId: 32,columnType: 9,value: "0"},- {columnId: 33,columnType: 10,value: "1"}]}]
If this is not enough info let me know. I don't know what else I can add though. Its pretty straight forward sorting the array, I just cant figure out how to do it.
UPDATE What I need is the tripSummary to be sorted by columnID. there are more than one line object, actually there is about 200+, I only added one because there would be way too much code. There is one tripSummary object per line object. So in the end each line will be sorted by tripSummary.columnId. Hope this clears more up.