Skip to content
Snippets Groups Projects
Commit a0a1979b authored by Bhabesh Bhabani Mukhopadhyay's avatar Bhabesh Bhabani Mukhopadhyay
Browse files

Descending order sorting by date in Observation list (suggested by : AFS)

parent d7f74993
No related branches found
No related tags found
No related merge requests found
,bhabesh,bhabesh-HP-NIBIO-Ubuntu.hitronhub.home,27.07.2021 16:02,file:///home/bhabesh/.config/libreoffice/4; ,bhabesh,bhabesh-HP-NIBIO-Ubuntu.hitronhub.home,29.07.2021 12:36,file:///home/bhabesh/.config/libreoffice/4;
\ No newline at end of file \ No newline at end of file
No preview for this file type
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<div v-if="observations"> <div v-if="observations">
<ul class="list-group" v-if="isInitialized"> <ul class="list-group" v-if="isInitialized">
<router-link :to="{name: 'Observation', params: {observationId:obs.observationId}}" class="list-group-item list-group-item-action " v-bind:class="{'text-danger':obs.isNew, 'text-primary':obs.toUpload, 'text-secondary':obs.isDeleted}" v-for="obs in observations" v-bind:key="obs.observationId"> <router-link :to="{name: 'Observation', params: {observationId:obs.observationId}}" class="list-group-item list-group-item-action " v-bind:class="{'text-danger':obs.isNew, 'text-primary':obs.toUpload, 'text-secondary':obs.isDeleted}" v-for="obs in sortedObservations" v-bind:key="obs.observationId">
<div v-if="obs.isDeleted"> <div v-if="obs.isDeleted">
<strike> {{ obs.timeOfObservation | dateFormat }} <b>{{obs.observationHeading}}</b> </strike> <strike> {{ obs.timeOfObservation | dateFormat }} <b>{{obs.observationHeading}}</b> </strike>
</div> </div>
...@@ -79,6 +79,15 @@ export default { ...@@ -79,6 +79,15 @@ export default {
}, },
},
computed : {
sortedObservations : function() {
this.observations.sort( (a,b) => {
return new Date(b.timeOfObservation) - new Date(a.timeOfObservation);
});
return this.observations;
}
}, },
filters: { filters: {
dateFormat: function(timeStr) { dateFormat: function(timeStr) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment