Commit 1967cd2b authored by peanut's avatar peanut Committed by hetech

Table: not emit triggers sort-change during initialization (#14625)

parent b9c63eec
......@@ -210,7 +210,8 @@ export default {
mounted() {
const { prop, order } = this.defaultSort;
this.store.commit('sort', { prop, order });
const init = true;
this.store.commit('sort', { prop, order, init });
},
beforeDestroy() {
......
......@@ -259,7 +259,7 @@ TableStore.prototype.mutations = {
changeSortCondition(states, options) {
states.data = sortData((states.filteredData || states._data || []), states);
if (!options || !options.silent) {
if (!options || !(options.silent || options.init)) {
this.table.$emit('sort-change', {
column: this.states.sortingColumn,
prop: this.states.sortProp,
......@@ -271,7 +271,7 @@ TableStore.prototype.mutations = {
},
sort(states, options) {
const { prop, order } = options;
const { prop, order, init } = options;
if (prop) {
states.sortProp = prop;
states.sortOrder = order || 'ascending';
......@@ -286,7 +286,9 @@ TableStore.prototype.mutations = {
}
if (states.sortingColumn) {
this.commit('changeSortCondition');
this.commit('changeSortCondition', {
init: init
});
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment