added sort feature for viewing of cards

This commit is contained in:
mae 2021-02-19 08:42:09 +08:00
parent 49df8f4b43
commit 2226ece4b7
3 changed files with 75 additions and 1 deletions

View file

@ -168,13 +168,16 @@ BlazeComponent.extendComponent({
cardsWithLimit(swimlaneId) {
const limit = this.cardlimit.get();
const defaultSort = { sort: 1 };
const sortBy = Session.get('sortBy') ? Session.get('sortBy') : defaultSort;
const selector = {
listId: this.currentData()._id,
archived: false,
};
if (swimlaneId) selector.swimlaneId = swimlaneId;
return Cards.find(Filter.mongoSelector(selector), {
sort: ['sort'],
// sort: ['sort'],
sort:sortBy,
limit,
});
},