Skip to content

fix(Table): Fix checkbox does not work when Table Filter value is num… #3052

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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