Fix sort event on every columns when sorter is true

close #12515
This commit is contained in:
afc163 2018-10-06 18:20:43 +08:00
parent 14b3f4e24f
commit 419287de2b
2 changed files with 30 additions and 19 deletions

View File

@ -358,6 +358,9 @@ export default class Table<T> extends React.Component<TableProps<T>, TableState<
}
toggleSortOrder(column: ColumnProps<T>) {
if (!column.sorter) {
return;
}
const { sortOrder, sortColumn } = this.state;
// 只同时允许一列进行排序,否则会导致排序顺序的逻辑问题
let newSortOrder: 'descend' | 'ascend' | undefined;

View File

@ -96,36 +96,44 @@
&.@{table-prefix-cls}-column-has-actions {
position: relative;
cursor: pointer;
// Very complicated styles logic but neccessary
&:hover {
background: #f5f5f5;
&.@{table-prefix-cls}-column-has-filters {
.@{iconfont-css-prefix}-filter,
.@{table-prefix-cls}-filter-icon {
background: #f5f5f5;
&:hover {
&.@{table-prefix-cls}-filter-open {
color: @text-color-secondary;
background: #ebebeb;
}
&:active {
color: @text-color;
}
// Very complicated styles logic but neccessary
&:hover {
.@{iconfont-css-prefix}-filter,
.@{table-prefix-cls}-filter-icon {
&:hover {
color: @text-color-secondary;
background: #ebebeb;
}
&:active {
color: @text-color;
}
}
}
}
.@{iconfont-css-prefix}-filter,
.@{table-prefix-cls}-filter-icon {
&.@{table-prefix-cls}-filter-open {
color: @text-color-secondary;
background: #ebebeb;
&.@{table-prefix-cls}-column-has-sorters {
cursor: pointer;
&:hover {
background: #f5f5f5;
.@{iconfont-css-prefix}-filter,
.@{table-prefix-cls}-filter-icon {
background: #f5f5f5;
}
}
}
&:active {
.@{table-prefix-cls}-column-sorter-up:not(.on),
.@{table-prefix-cls}-column-sorter-down:not(.on) {
color: @text-color-secondary;
&:active {
.@{table-prefix-cls}-column-sorter-up:not(.on),
.@{table-prefix-cls}-column-sorter-down:not(.on) {
color: @text-color-secondary;
}
}
}
}