Skip to content

Commit

Permalink
Fix DataTable, defaultSort
Browse files Browse the repository at this point in the history
  • Loading branch information
emiliorizzo committed Mar 5, 2019
1 parent 608f7fc commit 1c59d9f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
table.dark(v-if='data' ref='table' :class='tableClass')
thead(:class='theadClass')
tr
th.table-id(v-if='!isDefaultSortVisible')
th.table-id(v-if='sort && !isDefaultSortVisible')
.sort(v-if='sort && isSorted([defKeys[0]])')

//-field-title(:field='fields[defKeys[0]]')
Expand Down Expand Up @@ -143,7 +143,9 @@ export default {
return Object.keys(this.defaultSort)
},
defaultSort () {
return this.page.pages.defaultSort || {}
let { page } = this
let pages = page.pages || {}
return pages.defaultSort || { _id: -1 }
},
isDefaultSort () {
let sortKeys = this.sortKeys
Expand Down Expand Up @@ -181,7 +183,7 @@ export default {
key () {
let page = this.page
let req = (page) ? page.req : {}
return req.key
return (req) ? req.key : null
}
},
methods: {
Expand Down

0 comments on commit 1c59d9f

Please sign in to comment.