Browse Source

Merge branch 'develop' into feature/4576

文翼 6 years ago
parent
commit
b99600d2e6

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

@@ -41,6 +41,7 @@ $.extend($.fn.bootstrapTable.defaults, {
   groupByFormatter: undefined
 })
 
+const Utils = $.fn.bootstrapTable.utils
 const BootstrapTable = $.fn.bootstrapTable.Constructor
 const _initSort = BootstrapTable.prototype.initSort
 const _initBody = BootstrapTable.prototype.initBody
@@ -55,11 +56,19 @@ 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 = a[that.options.groupByField].toString()
-        b = b[that.options.groupByField].toString()
-        return a.localeCompare(b, undefined, { numeric: true })
-      })
+      if (this.options.customSort) {
+        Utils.calculateObjectValue(this.options, this.options.customSort, [
+          this.options.sortName,
+          this.options.sortOrder,
+          this.data
+        ])
+      } else {
+        this.data.sort((a, b) => {
+          a = a[that.options.groupByField].toString()
+          b = b[that.options.groupByField].toString()
+          return a.localeCompare(b, undefined, { numeric: true })
+        })
+      }
     }
 
     const groups = groupBy(that.data, item => [item[that.options.groupByField]])

+ 1 - 1
src/extensions/reorder-columns/bootstrap-table-reorder-columns.js

@@ -122,7 +122,7 @@ BootstrapTable.prototype.makeRowsReorderable = function () {
       let columnsHidden = []
       let columnIndex = -1
       const optionsColumns = []
-      that.$header.find('th').each(function (i) {
+      that.$header.find('th:not(.detail)').each(function (i) {
         ths.push($(this).data('field'))
         formatters.push($(this).data('formatter'))
       })