Browse Source

If filterOrderBy is set to 'server' then add options in the order provided by the server.

mattosaurus 5 years ago
parent
commit
24a3c71ee8
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/extensions/filter-control/bootstrap-table-filter-control.js

+ 5 - 3
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -59,9 +59,11 @@ const UtilsFilterControl = {
     const $selectControl = $(selectControl.get(selectControl.length - 1))
     const $selectControl = $(selectControl.get(selectControl.length - 1))
     const $opts = $selectControl.find('option:gt(0)')
     const $opts = $selectControl.find('option:gt(0)')
 
 
-    $opts.sort((a, b) => {
-      return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1)
-    })
+    if (orderBy !== 'server') {
+      $opts.sort((a, b) => {
+        return Utils.sort(a.textContent, b.textContent, orderBy === 'desc' ? -1 : 1)
+      })
+    }
 
 
     $selectControl.find('option:gt(0)').remove()
     $selectControl.find('option:gt(0)').remove()
     $selectControl.append($opts)
     $selectControl.append($opts)