Browse Source

Table: Remove `sort-clear` and `filter-clear` event

lirilsu 7 years ago
parent
commit
1310bdee26

+ 1 - 3
examples/docs/en-US/table.md

@@ -1710,7 +1710,7 @@ For table of numbers, you can add an extra row at the table footer displaying ea
 ### 合并行或列
 
 多行或多列共用一个数据时,可以合并行或列。
-:::demo 通过给`table`传入`span-method`方法可以实现合并行或列,方法的参数是一个对象,里面包含当前行`row`、当前列`column`、当前行号`rowIndex`、当前列号`columnIndex`四个属性。该函数可以返回一个二维数组,第一个元素代表`rowspan`,第二个元素代表`colspan`。 也可以返回一个键名为`rowsapn`和`colspan`的对象。
+:::demo 通过给`table`传入`span-method`方法可以实现合并行或列,方法的参数是一个对象,里面包含当前行`row`、当前列`column`、当前行号`rowIndex`、当前列号`columnIndex`四个属性。该函数可以返回一个包含两个元素的数组,第一个元素代表`rowspan`,第二个元素代表`colspan`。 也可以返回一个键名为`rowsapn`和`colspan`的对象。
 
 ```html
 <template>
@@ -1890,8 +1890,6 @@ For table of numbers, you can add an extra row at the table footer displaying ea
 | current-change | triggers when current row changes | currentRow, oldCurrentRow |
 | header-dragend | triggers when finish dragging header | newWidth, oldWidth, column, event |
 | expand | triggers when user expands or collapses a row | row, expanded |
-| sort-clear | 当调用清空排序条件的时候会触发该事件 | - |
-| filter-clear | 当调用清空条件的时候会触发该事件 | - |
 
 ### Table Methods
 | Method | Description | Parameters |

+ 1 - 3
examples/docs/zh-CN/table.md

@@ -1773,7 +1773,7 @@
 ### 合并行或列
 
 多行或多列共用一个数据时,可以合并行或列。
-:::demo 通过给`table`传入`span-method`方法可以实现合并行或列,方法的参数是一个对象,里面包含当前行`row`、当前列`column`、当前行号`rowIndex`、当前列号`columnIndex`四个属性。该函数可以返回一个二维数组,第一个元素代表`rowspan`,第二个元素代表`colspan`。 也可以返回一个键名为`rowsapn`和`colspan`的对象。
+:::demo 通过给`table`传入`span-method`方法可以实现合并行或列,方法的参数是一个对象,里面包含当前行`row`、当前列`column`、当前行号`rowIndex`、当前列号`columnIndex`四个属性。该函数可以返回一个包含两个元素的数组,第一个元素代表`rowspan`,第二个元素代表`colspan`。 也可以返回一个键名为`rowsapn`和`colspan`的对象。
 
 ```html
 <template>
@@ -1953,8 +1953,6 @@
 | current-change | 当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的 highlight-current-row 属性 | currentRow, oldCurrentRow |
 | header-dragend | 当拖动表头改变了列的宽度的时候会触发该事件 | newWidth, oldWidth, column, event |
 | expand | 当用户对某一行展开或者关闭的上会触发该事件 | row, expanded |
-| sort-clear | 当调用清空排序条件的时候会触发该事件 | - |
-| filter-clear | 当调用清空条件的时候会触发该事件 | - |
 
 ### Table Methods
 | 方法名 | 说明 | 参数 |

+ 0 - 4
packages/table/src/table-store.js

@@ -433,8 +433,6 @@ TableStore.prototype.clearFilter = function() {
     values: [],
     silent: true
   });
-
-  this.table.$emit('filter-clear');
 };
 
 TableStore.prototype.clearSort = function() {
@@ -447,8 +445,6 @@ TableStore.prototype.clearSort = function() {
   this.commit('changeSortCondition', {
     silent: true
   });
-
-  this.table.$emit('sort-clear');
 };
 
 TableStore.prototype.updateAllSelected = function() {

+ 2 - 5
packages/table/src/table.vue

@@ -277,11 +277,8 @@
           if (refs.fixedBodyWrapper) refs.fixedBodyWrapper.scrollTop = this.scrollTop;
           if (refs.rightFixedBodyWrapper) refs.rightFixedBodyWrapper.scrollTop = this.scrollTop;
           const maxScrollLeftPosition = this.scrollWidth - this.offsetWidth - 1;
-
           const scrollLeft = this.scrollLeft;
-          if (!self.layout.scrollX) {
-            self.scrollPosition = 'none';
-          } else if (scrollLeft >= maxScrollLeftPosition) {
+          if (scrollLeft >= maxScrollLeftPosition) {
             self.scrollPosition = 'right';
           } else if (scrollLeft === 0) {
             self.scrollPosition = 'left';
@@ -504,7 +501,7 @@
         resizeProxyVisible: false,
         // 是否拥有多级表头
         isGroup: false,
-        scrollPosition: layout.scrollX ? 'left' : 'none'
+        scrollPosition: 'left'
       };
     }
   };