|
@@ -1,6 +1,7 @@
|
|
import Vue from 'vue';
|
|
import Vue from 'vue';
|
|
import debounce from 'throttle-debounce/debounce';
|
|
import debounce from 'throttle-debounce/debounce';
|
|
import merge from 'element-ui/src/utils/merge';
|
|
import merge from 'element-ui/src/utils/merge';
|
|
|
|
+import { hasClass, addClass, removeClass } from 'element-ui/src/utils/dom';
|
|
import { orderBy, getColumnById, getRowIdentity } from './util';
|
|
import { orderBy, getColumnById, getRowIdentity } from './util';
|
|
|
|
|
|
const sortData = (data, states) => {
|
|
const sortData = (data, states) => {
|
|
@@ -192,6 +193,17 @@ TableStore.prototype.mutations = {
|
|
changeSortCondition(states, options) {
|
|
changeSortCondition(states, options) {
|
|
states.data = sortData((states.filteredData || states._data || []), states);
|
|
states.data = sortData((states.filteredData || states._data || []), states);
|
|
|
|
|
|
|
|
+ const el = this.table.$el;
|
|
|
|
+ if (el) {
|
|
|
|
+ const data = states.data;
|
|
|
|
+ const tr = el.querySelector('tbody').children;
|
|
|
|
+ const rows = [].filter.call(tr, row => hasClass(row, 'el-table__row'));
|
|
|
|
+ const row = rows[data.indexOf(states.currentRow)];
|
|
|
|
+
|
|
|
|
+ [].forEach.call(rows, row => removeClass(row, 'current-row'));
|
|
|
|
+ addClass(row, 'current-row');
|
|
|
|
+ }
|
|
|
|
+
|
|
if (!options || !options.silent) {
|
|
if (!options || !options.silent) {
|
|
this.table.$emit('sort-change', {
|
|
this.table.$emit('sort-change', {
|
|
column: this.states.sortingColumn,
|
|
column: this.states.sortingColumn,
|