This commit is contained in:
梁灏 2018-01-19 17:34:02 +08:00
parent 57fe55624e
commit b34e09b8f9
3 changed files with 136 additions and 50 deletions

View file

@ -522,7 +522,8 @@
});
return data;
},
handleSort (index, type) {
handleSort (_index, type) {
const index = this.GetOriginalIndex(_index);
this.cloneColumns.forEach((col) => col._sortType = 'normal');
const key = this.cloneColumns[index].key;
@ -582,11 +583,23 @@
this.cloneColumns[index]._filterVisible = false;
this.$emit('on-filter-change', column);
},
handleFilterSelect (index, value) {
/**
* #2832
* 应该区分当前表头的 column 是左固定还是右固定
* 否则执行到 $parent 方法的 index cloneColumns index 是不对应的
* 左固定和右固定要区分对待
* 所以此方法用来获取正确的 index
* */
GetOriginalIndex (_index) {
return this.cloneColumns.findIndex(item => item._index === _index);
},
handleFilterSelect (_index, value) {
const index = this.GetOriginalIndex(_index);
this.cloneColumns[index]._filterChecked = [value];
this.handleFilter(index);
},
handleFilterReset (index) {
handleFilterReset (_index) {
const index = this.GetOriginalIndex(_index);
this.cloneColumns[index]._isFiltered = false;
this.cloneColumns[index]._filterVisible = false;
this.cloneColumns[index]._filterChecked = [];