Skip to content

Commit 1cade9c

Browse files
committed
Better column sorting.
1 parent cdfea75 commit 1cade9c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/BoardLibrary.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@ module.exports = {
4040
},
4141
sorted: function() {
4242
// update each game with its index in the array
43-
this.games.forEach(function (value, index) {
44-
value.index = index
43+
this.games.forEach(function (game, index) {
44+
game.index = index
4545
})
46-
return _.sortBy(this.games, [this.sort])
46+
// always sort by name, just sort by type first, if necessary
47+
var sortBy = this.sort == 'type' ? ['type'] : []
48+
sortBy.push(function (game) {
49+
return game.name.toLowerCase()
50+
})
51+
return _.sortBy(this.games, sortBy)
4752
}
4853
},
4954
methods: {

0 commit comments

Comments
 (0)