We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 567e9a7 commit 18bb96cCopy full SHA for 18bb96c
src/components/MdTable/MdTable.vue
@@ -105,12 +105,18 @@
105
const sortBy = this.MdTable.sort
106
const aAttr = getObjectAttribute(a, sortBy)
107
const bAttr = getObjectAttribute(b, sortBy)
108
+ const isAsc = this.MdTable.sortOrder === 'asc'
109
+ let isNumber = typeof aAttr === 'number'
110
- if (this.MdTable.sortOrder === 'desc') {
- return aAttr.localeCompare(bAttr)
111
+ if (isNumber) {
112
+ return isAsc ? (bAttr - aAttr) : (aAttr - bAttr)
113
}
114
- return bAttr.localeCompare(aAttr)
115
+ if (isAsc) {
116
+ return bAttr.localeCompare(aAttr)
117
+ }
118
+
119
+ return aAttr.localeCompare(bAttr)
120
})
121
122
0 commit comments