Feature/7390
@@ -522,6 +522,15 @@ The calling method syntax: `$('#table').bootstrapTable('method', parameter)`.
- **Example:** [Sort By](https://examples.bootstrap-table.com/#methods/sort-by.html)
+## sortReset
+
+- **Parameter:** `undefined`
+- **Detail:**
+ Resets sort state of the table regardless of whether caused by the user or programmatically.
+- **Example:** [Sort reset](https://examples.bootstrap-table.com/#methods/sort-reset.html)
## toggleDetailView
@@ -534,6 +534,12 @@ class BootstrapTable {
}
+ sortReset () {
+ this.options.sortName = undefined
+ this.options.sortOrder = undefined
+ this._sort()
+ }
sortBy (params) {
this.options.sortName = params.field
this.options.sortOrder = params.hasOwnProperty('sortOrder') ? params.sortOrder : 'asc'
@@ -483,7 +483,7 @@ const METHODS = [
'togglePagination', 'toggleFullscreen', 'toggleView',
'resetSearch',
'filterBy',
- 'sortBy',
+ 'sortBy', 'sortReset',
'scrollTo', 'getScrollPosition',
'selectPage', 'prevPage', 'nextPage',
'toggleDetailView',