I have items that I\'m wanting to sort, my items have computed properties on the model that include winning
, bidding
, closed
, and wa
consider winning = 0, bidding = 1, watching = 2, closed = 3
var arrayOfBids = [a, b, c, d, e, f];
arrayOfBids.sort(function(bid1, bid2) {
return getBidStatusVal(bid1.status) - getBidStatusVal(bid2.status);
function getBidStatusVal(bidStatus) {
switch(bidStatus) {
case "winning": return 0;
case "bidding": return 1;
case "watching": return 2;
case "closed": return 3;
default: return 4;
}
}
});