浏览代码

cast the value to an string, to prevent issues with other data types

Dustin Utecht 6 年之前
父节点
当前提交
d0b43fadfe
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/extensions/group-by-v2/bootstrap-table-group-by.js

+ 1 - 1
src/extensions/group-by-v2/bootstrap-table-group-by.js

@@ -55,7 +55,7 @@ BootstrapTable.prototype.initSort = function (...args) {
   if ((this.options.groupBy) && (this.options.groupByField !== '')) {
 
     if ((this.options.sortName !== this.options.groupByField)) {
-      this.data.sort((a, b) => a[that.options.groupByField].localeCompare(b[that.options.groupByField]))
+      this.data.sort((a, b) => a[that.options.groupByField].toString().localeCompare(b[that.options.groupByField].toString(), undefined, {numeric: true}))
     }
 
     const groups = groupBy(that.data, item => [item[that.options.groupByField]])