filterDropdown propagation problem #48971
-
I have a custom table filter: const getColumnProps = (
dataIndex: (keyof Filter)[]
): TableColumnType<ColType> => ({
filterDropdown: ({
setSelectedKeys,
selectedKeys,
confirm,
clearFilters,
close,
}) => (
<Space
direction="vertical"
style={{ padding: "1rem" }}
onKeyDown={(e) => e.stopPropagation()}
>
<DatePicker.RangePicker
value={
selectedKeys as unknown as React.ComponentProps<
typeof DatePicker.RangePicker
>["value"]
}
format="LLL"
onChange={(value) => setSelectedKeys(value as any)}
/>
<Space>
<Button
type="primary"
onClick={() => {
confirm({ closeDropdown: true });
if (!selectedKeys[0] && !selectedKeys[1])
setFilter((filter) => {
dataIndex.forEach((dataIndex) => delete filter[dataIndex]);
});
else
setFilter((f) => {
dataIndex.forEach((dataIndex, i) => {
(f[dataIndex] as string) = (
selectedKeys[i] as unknown as dayjs.Dayjs
).toISOString();
});
});
}}
icon={<SearchOutlined />}
size="small"
>
Filter
</Button>
<Button
onClick={() => handleReset(clearFilters, dataIndex)}
size="small"
>
Reset
</Button>
<Button type="link" size="small" onClick={close}>
Close
</Button>
</Space>
</Space>
),
filterIcon: (filtered: boolean) => (
<SearchOutlined style={{ color: filtered ? "#1677ff" : undefined }} />
),
}); But when I try to select a date the popup just closes 2024-05-18.125108.mp4Is there any way to fix this? |
Beta Was this translation helpful? Give feedback.
Answered by
nouman2075
May 19, 2024
Replies: 2 comments 2 replies
-
Additional question : |
Beta Was this translation helpful? Give feedback.
2 replies
-
Pass |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
gosvoh
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pass
getPopupContainer={(triggerNode) => triggerNode.parentNode as HTMLElement}
to<DatePicker.RangePicker ...