orders sites on mount
This commit is contained in:
parent
9a53ea45d0
commit
c7c096d3c4
|
@ -131,8 +131,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
columns_order: {'title': 'asc', 'artist': 'asc', 'collection': 'asc', 'date': 'asc'},
|
||||
active_column: 'title',
|
||||
column_order: 'asc',
|
||||
active_column: 'date',
|
||||
faSortAlphaUp: faSortAlphaUp,
|
||||
faSortAlphaDown: faSortAlphaDown,
|
||||
};
|
||||
|
@ -144,7 +143,11 @@ export default {
|
|||
|
||||
},
|
||||
mounted() {
|
||||
this.setSites(JSON.parse(this.collections))
|
||||
var payload = {
|
||||
'sites': JSON.parse(this.collections),
|
||||
'column_name': 'date',
|
||||
'order': this.columns_order['date']}
|
||||
this.setSites(payload)
|
||||
|
||||
},
|
||||
methods: {
|
||||
|
@ -154,7 +157,7 @@ export default {
|
|||
} else {
|
||||
this.active_column = name
|
||||
}
|
||||
this.setColumnOrder({'name': name, 'order': this.columns_order[name]})
|
||||
this.setColumnOrder({'column_name': name, 'order': this.columns_order[name]})
|
||||
},
|
||||
isActiveCol: function(name) {
|
||||
return name == this.active_column ? true : false
|
||||
|
|
|
@ -22,8 +22,8 @@ const store = new Vuex.Store({
|
|||
setSearchText(state, text) {
|
||||
state.search_text = text
|
||||
},
|
||||
setSites(state, sites) {
|
||||
state.sites = sites
|
||||
setSites(state, payload) {
|
||||
state.sites = _.sortBy(payload.sites, payload.column_name)
|
||||
},
|
||||
setFilteredSites(state, filtered_site_ids) {
|
||||
console.log(filtered_site_ids)
|
||||
|
@ -38,7 +38,7 @@ const store = new Vuex.Store({
|
|||
state.filtered_sites = sites
|
||||
},
|
||||
setColumnOrder(state, payload) {
|
||||
var column_name = payload.name
|
||||
var column_name = payload.column_name
|
||||
var order = payload.order
|
||||
state.sites = _.sortBy(state.sites, column_name)
|
||||
state.filtered_sites = _.sortBy(state.filtered_sites, column_name)
|
||||
|
|
Loading…
Reference in New Issue