Skip to content

Commit

Permalink
fix(Table): Fix checkbox does not work when Table Filter value is num…
Browse files Browse the repository at this point in the history
…ber type (#3052)
  • Loading branch information
dogrod authored Oct 28, 2020
1 parent ef9797d commit f194973
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions components/table/filterDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default {
[`${dropdownPrefixCls}-submenu-contain-selected`]: containSelected,
});
return (
<SubMenu title={item.text} popupClassName={subMenuCls} key={item.value.toString()}>
<SubMenu title={item.text} popupClassName={subMenuCls} key={item.value}>
{this.renderMenus(item.children)}
</SubMenu>
);
Expand Down Expand Up @@ -246,13 +246,10 @@ export default {
const { sSelectedKeys: selectedKeys } = this.$data;
const multiple = 'filterMultiple' in column ? column.filterMultiple : true;

// We still need trade key as string since Menu render need string
// const internalSelectedKeys = (selectedKeys || []).map(key => key.toString());

const input = multiple ? (
<Checkbox checked={selectedKeys && selectedKeys.indexOf(item.value.toString()) >= 0} />
<Checkbox checked={selectedKeys && selectedKeys.indexOf(item.value) >= 0} />
) : (
<Radio checked={selectedKeys && selectedKeys.indexOf(item.value.toString()) >= 0} />
<Radio checked={selectedKeys && selectedKeys.indexOf(item.value) >= 0} />
);

return (
Expand Down Expand Up @@ -299,7 +296,7 @@ export default {
class={dropdownMenuClass}
onSelect={this.setSelectedKeys}
onDeselect={this.setSelectedKeys}
selectedKeys={originSelectedKeys && originSelectedKeys.map(val => val.toString())}
selectedKeys={originSelectedKeys && originSelectedKeys.map(val => val)}
getPopupContainer={getPopupContainer}
>
{this.renderMenus(column.filters)}
Expand Down

0 comments on commit f194973

Please sign in to comment.