Compare commits

...

5 Commits

Author SHA1 Message Date
3ccf333fc6 Update event name 2023-03-31 15:21:36 -07:00
f3fc2c3471 bubble current sort up to timelist view 2023-03-31 15:01:07 -07:00
2f715492e5 Sort by specified sort 2023-03-31 14:36:15 -07:00
2f6a1840ac Sort activities before filtering them 2023-03-31 13:47:14 -07:00
ef86e023e9 Sort before getting scroll position 2023-03-31 11:23:23 -07:00
2 changed files with 27 additions and 7 deletions

View File

@ -30,6 +30,7 @@
:header-items="headerItems"
:default-sort="defaultSort"
class="sticky"
@sortChanged="updateDefaultSort"
/>
</div>
</template>
@ -345,11 +346,12 @@ export default {
groups.forEach((key) => {
activities = activities.concat(this.planData[key]);
});
activities = activities.sort(this.sortByProperty);
activities = activities.filter(this.filterActivities);
activities = this.applyStyles(activities);
this.setScrollTop();
// sort by start time
this.planActivities = activities.sort(this.sortByStartTime);
this.planActivities = activities;
},
updateTimeStampAndListActivities(time) {
this.timestamp = time;
@ -472,16 +474,29 @@ export default {
const sortOrder = SORT_ORDER_OPTIONS[this.domainObject.configuration.sortOrderIndex];
const property = sortOrder.property;
const direction = sortOrder.direction.toLowerCase() === 'asc';
this.defaultSort = {
this.updateDefaultSort({
property,
defaultDirection: direction
direction
});
},
updateDefaultSort(sortOption) {
this.defaultSort = {
property: sortOption.property,
defaultDirection: sortOption.direction
};
},
sortByStartTime(a, b) {
const numA = parseInt(a.start, 10);
const numB = parseInt(b.start, 10);
sortByProperty(a, b) {
const property = this.defaultSort.property;
const defaultDirection = this.defaultSort.defaultDirection;
return numA - numB;
const numA = parseInt(a[property], 10);
const numB = parseInt(b[property], 10);
if (defaultDirection) {
return numA - numB;
} else {
return numB - numA;
}
},
setStatus(status) {
this.status = status;

View File

@ -136,6 +136,11 @@ export default {
)
);
}
this.$emit('sortChanged', {
property: this.sortBy,
defaultDirection: this.ascending
});
}
}
};