From d21523ef8c7c1f6459dfd183186a308d0e694259 Mon Sep 17 00:00:00 2001 From: Graeme Yeates Date: Mon, 17 Jul 2017 15:03:56 -0400 Subject: [PATCH] Use classNames to set ant-column-sort Table attribute --- components/table/Table.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/components/table/Table.tsx b/components/table/Table.tsx index dc75b72b41..5746065a3f 100755 --- a/components/table/Table.tsx +++ b/components/table/Table.tsx @@ -345,7 +345,7 @@ export default class Table extends React.Component, any> { let columnTitle = this.props.defaultSortOrder.columnTitle; return { sortColumn: flatFilter(columns || this.columns || [], column => column.title === columnTitle)[0], - sortOrder: this.props.defaultSortOrder.sortOrder + sortOrder: this.props.defaultSortOrder.sortOrder, }; } @@ -753,10 +753,9 @@ export default class Table extends React.Component, any> { if (column.sorter) { let isSortColumn = this.isSortColumn(column); if (isSortColumn) { - column.className = column.className || ''; - if (sortOrder) { - column.className += ` ${prefixCls}-column-sort`; - } + column.className = classNames(column.className, { + [`${prefixCls}-column-sort`]: sortOrder, + }); } const isAscend = isSortColumn && sortOrder === 'ascend'; const isDescend = isSortColumn && sortOrder === 'descend';