Skip to content
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

[BUG] useAntdTable使用defaultParams传递的formData获取不到 #2258

Closed
hs-ltbyce opened this issue Jul 19, 2023 · 4 comments
Closed

[BUG] useAntdTable使用defaultParams传递的formData获取不到 #2258

hs-ltbyce opened this issue Jul 19, 2023 · 4 comments
Assignees

Comments

@hs-ltbyce
Copy link

hs-ltbyce commented Jul 19, 2023

const { tableProps } = useAntdTable(getTableData, {
  defaultParams: [
    { current: 1, pageSize: 20 },
    {
      test1: "test1"
    }
  ]
});

通过这种方式传递的formData,getTableData获取不到formData

demo: https://codesandbox.io/s/heuristic-water-p97d86?file=/App.tsx:662-823

@hs-ltbyce hs-ltbyce changed the title useAntdTable使用defaultParams传递的formData获取不到 [BUG] useAntdTable使用defaultParams传递的formData获取不到 Jul 19, 2023
@hchlq
Copy link
Collaborator

hchlq commented Jul 21, 2023

感谢反馈~

@hchlq hchlq self-assigned this Jul 21, 2023
@hchlq hchlq added the bug Something isn't working label Jul 21, 2023
@askwuxue
Copy link
Contributor

const { tableProps } = useAntdTable(getTableData, {
  defaultParams: [
    { current: 1, pageSize: 20 },
    {
      test1: "test1"
    }
  ]
});

通过这种方式传递的formData,getTableData获取不到formData

demo: https://codesandbox.io/s/heuristic-water-p97d86?file=/App.tsx:662-823

image
defaultParams数据第二项是表单相关数据,但是提供的demo中没有Form 实例,所以获取不到formData,可以考虑加上form参数。
image

@askwuxue
Copy link
Contributor

const { tableProps } = useAntdTable(getTableData, {
  defaultParams: [
    { current: 1, pageSize: 20 },
    {
      test1: "test1"
    }
  ]
});

通过这种方式传递的formData,getTableData获取不到formData
demo: https://codesandbox.io/s/heuristic-water-p97d86?file=/App.tsx:662-823

image defaultParams数据第二项是表单相关数据,但是提供的demo中没有Form 实例,所以获取不到formData,可以考虑加上form参数。 image

补充下,不只是加form参数,defaultParams第二个参数是在Form和Table联动的时候使用,可以看这个https://ahooks.js.org/zh-CN/hooks/use-antd-table 联动的例子,单纯使用Table的话,第二个参数是没有用的

@hchlq hchlq removed the bug Something isn't working label Jul 21, 2023
@hchlq
Copy link
Collaborator

hchlq commented Jul 21, 2023

上面解释是正解。我忽略了 form 了,可以看看这个 demo

@hchlq hchlq closed this as completed Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants