vxe-table 3.16.7 → 3.16.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,9 +23,11 @@ function getTableOns(_vm) {
23
23
  if (proxyConfig) {
24
24
  if (proxyOpts.sort) {
25
25
  ons['sort-change'] = _vm.sortChangeEvent;
26
+ ons['clear-all-sort'] = _vm.clearAllSortEvent;
26
27
  }
27
28
  if (proxyOpts.filter) {
28
29
  ons['filter-change'] = _vm.filterChangeEvent;
30
+ ons['clear-all-filter'] = _vm.clearAllFilterEvent;
29
31
  }
30
32
  }
31
33
  return ons;
@@ -905,6 +907,23 @@ export default {
905
907
  $xeGrid.triggerToolbarCommitEvent(tool, evnt);
906
908
  $xeGrid.dispatchEvent('toolbar-tool-click', { code: tool.code, tool }, evnt);
907
909
  },
910
+ pageChangeEvent(params) {
911
+ const $xeGrid = this;
912
+ const props = $xeGrid;
913
+ const reactData = $xeGrid.reactData;
914
+ const { proxyConfig } = props;
915
+ const { tablePage } = reactData;
916
+ const { $event, currentPage, pageSize } = params;
917
+ const proxyOpts = $xeGrid.computeProxyOpts;
918
+ tablePage.currentPage = currentPage;
919
+ tablePage.pageSize = pageSize;
920
+ $xeGrid.dispatchEvent('page-change', params, $event);
921
+ if (proxyConfig && isEnableConf(proxyOpts)) {
922
+ $xeGrid.commitProxy('query').then((rest) => {
923
+ $xeGrid.dispatchEvent('proxy-query', rest, $event);
924
+ });
925
+ }
926
+ },
908
927
  sortChangeEvent(params) {
909
928
  const $xeGrid = this;
910
929
  const props = $xeGrid;
@@ -925,22 +944,25 @@ export default {
925
944
  }
926
945
  $xeGrid.dispatchEvent('sort-change', params, params.$event);
927
946
  },
928
- pageChangeEvent(params) {
947
+ clearAllSortEvent(params) {
929
948
  const $xeGrid = this;
930
949
  const props = $xeGrid;
931
950
  const reactData = $xeGrid.reactData;
951
+ const $xeTable = $xeGrid.$refs.refTable;
932
952
  const { proxyConfig } = props;
933
- const { tablePage } = reactData;
934
- const { $event, currentPage, pageSize } = params;
935
953
  const proxyOpts = $xeGrid.computeProxyOpts;
936
- tablePage.currentPage = currentPage;
937
- tablePage.pageSize = pageSize;
938
- $xeGrid.dispatchEvent('page-change', params, $event);
939
- if (proxyConfig && isEnableConf(proxyOpts)) {
940
- $xeGrid.commitProxy('query').then((rest) => {
941
- $xeGrid.dispatchEvent('proxy-query', rest, $event);
942
- });
954
+ const sortOpts = $xeTable.computeSortOpts;
955
+ // 如果是服务端排序
956
+ if (sortOpts.remote) {
957
+ reactData.sortData = params.sortList;
958
+ if (proxyConfig && isEnableConf(proxyOpts)) {
959
+ reactData.tablePage.currentPage = 1;
960
+ $xeGrid.commitProxy('query').then((rest) => {
961
+ $xeGrid.dispatchEvent('proxy-query', rest, params.$event);
962
+ });
963
+ }
943
964
  }
965
+ $xeGrid.dispatchEvent('clear-all-sort', params, params.$event);
944
966
  },
945
967
  filterChangeEvent(params) {
946
968
  const $xeGrid = this;
@@ -962,6 +984,26 @@ export default {
962
984
  }
963
985
  $xeGrid.dispatchEvent('filter-change', params, params.$event);
964
986
  },
987
+ clearAllFilterEvent(params) {
988
+ const $xeGrid = this;
989
+ const props = $xeGrid;
990
+ const reactData = $xeGrid.reactData;
991
+ const $xeTable = $xeGrid.$refs.refTable;
992
+ const { proxyConfig } = props;
993
+ const proxyOpts = $xeGrid.computeProxyOpts;
994
+ const filterOpts = $xeTable.computeFilterOpts;
995
+ // 如果是服务端过滤
996
+ if (filterOpts.remote) {
997
+ reactData.filterData = params.filterList;
998
+ if (proxyConfig && isEnableConf(proxyOpts)) {
999
+ reactData.tablePage.currentPage = 1;
1000
+ $xeGrid.commitProxy('query').then((rest) => {
1001
+ $xeGrid.dispatchEvent('proxy-query', rest, params.$event);
1002
+ });
1003
+ }
1004
+ }
1005
+ $xeGrid.dispatchEvent('clear-all-filter', params, params.$event);
1006
+ },
965
1007
  submitFormEvent(params) {
966
1008
  const $xeGrid = this;
967
1009
  const props = $xeGrid;