-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
ProTable onDataSourceChange wrong typescript 🐛[BUG] #7353
Comments
Hi there, Thank you for reaching out to us about the issue with the Looking at the code and documentation, it seems that there is a discrepancy with the typing. I understand that you are encountering a situation where two different To resolve this issue, you can try the following steps:
import { ProColumns, ProTableProps } from 'ant-design/pro-table';
interface YourDataItemType {
// Define your data item type here
}
const columns: ProColumns<YourDataItemType>[] = [...];
const YourComponent: React.FC = () => {
const handleDataSourceChange = (newDataSource: YourDataItemType[], action: 'add' | 'update' | 'delete') => {
// Handle the dataSource change here based on the action
};
return (
<ProTable<YourDataItemType>
columns={columns}
onDataSourceChange={handleDataSourceChange}
// other props
/>
);
}; By manually typing the prop, you can now handle the
I hope this helps! Let me know if you have any further questions. |
Hello @matteomaiocchi99. Please provide a online reproduction by forking this link https://codesandbox.io/ or a minimal GitHub repository. 你好 @matteomaiocchi99, 我们需要你提供一个在线的重现实例以便于我们帮你排查问题。你可以通过点击 此处 创建一个 codesandbox 或者提供一个最小化的 GitHub 仓库。 |
Good morning, I noticed that there is an error in the typing of the
onDataSourceChange
prop of theProTable
component: according to the code typing (and also the documentation), the function should receive only one prop, namelydataSource
, but in reality, two differentdataSource
are being passed.Thank you for your support.
ant-design/pro-components => version 2.6.2
The text was updated successfully, but these errors were encountered: