Comments (5)
你是想在 Table 使用 sorter 访问后台?比如 https://ant.design/components/table-cn/#components-table-demo-ajax
这个场景不适用于 useFormTable。useFormTable 是用于表单作为查询条件,进行搜索,之后请求后台,Table 展示。而问题的需求是想不通过 Form 作为查询条件,而是通过 Table 来作为查询条件去请求后台。
在业务里,要是有 Form,又在 Table 里去做查询是不推荐的,FormTable 比 在 Table 里做 sorter 及 filter 更好的地方在于回填及以及更多的搜索条件。
那需要有什么方式来做?
- 使用 useFormTable,sorter 及 filter 只是后台查询的条件,在 Form 中加 Select 即可,而不使用 Table 的 sorter 及 filter
import { Select } from 'antd';
const {Form, Table} = useFormTable(config);
<Form>
<Form.Item name="sorted">
<Select>
<Select.Option value="1">sorter 1</Select.Option>
<Select.Option value="2">sorter 2</Select.Option>
</Select>
</Form.Item>
<Form.Item name="filter">
<Select>
<Select.Option value="1">filter 1</Select.Option>
<Select.Option value="2">filter 2</Select.Option>
</Select>
</Form.Item>
</Form>
- 加一个场景,比如 useRemoteTable 的场景。(需要在 sunflower 加上)
const { Table } = useRemoteTable({
sorter: () => Promise,
filter: () => Promise,
});
<Table />
from sunflower.
好的,谢谢了。确实是想在Table使用sorter访问后台,尝试了很多方法,行不通,就来请教一下。
from sunflower.
@lencx 是很通用的需求,会加上一个 useRemoteTable
from sunflower.
嗯嗯,谢谢了
from sunflower.
import { useFormTable } from 'sunflower-antd';
useFormTable({
search({ currentPage, pageSize, filters, sorter, ...formValues })
})
from sunflower.
Related Issues (20)
- [Error on Development] Can't find module
- Go to previous step without checking validation HOT 1
- useStepFrom Steps onChange bug HOT 2
- Does it also work with AntDesign 5?
- useStepsForm does not preserve form field values when returning to Previous step
- useFormTable spec HOT 1
- doc
- DOC
- useModelForm spec HOT 6
- useModal spec HOT 2
- useFormtable add reset方法
- useStepsForm spec HOT 1
- useForm spec
- useFormTable 如何在用编程的方式触发刷新 HOT 3
- useFormTable 和 useModalForm 怎么同时使用 antd@3 HOT 3
- typescript下useFormTable返回的tableProps和antd的Table类型不匹配 HOT 1
- [Bug] useStepsForm should prevent form submitting when the form is invalid HOT 2
- remove monorepo
- i18n doc and 1.0
- will upgrade to antd 4.0? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sunflower.