ant-design / ant-design/pro-components
👑 [需求] ProTable 希望可以在ActionRef里面加个method来提取当前的filter和sort
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
### 🔩 所属模块或组件
ProTable > ActionRef
### 🥰 需求描述
希望可以在ActionRef里面加个method来提取当前的filter和sort
### ⛰ 功能需求适用场景
我这是用来提取当前filter和sort,用在export data的params(protable外面)
```
async function exportToExcel() {
await partService.GetPlainParts(filterParams)
.then((data) => {
fileUtil.exportDataToExcel(
'part_list',
columns.filter(x => x.dataIndex) as ProColumns[],
data,
[{dataIndex: 'printingTime', isTime: true,}])
})
}
```
### 🧐 解决方案
这是我当前的解决方法,每当我做出filter或者sort时候,用state记录起来
```
const [filterParams, setFilterParams] = useState({});
request={async (params, sort) => {
console.log(params, sort);
setFilterParams({
......
})
```
### 🚑 其他信息
Contributor guide
Research direction
Start with the ProTable ActionRef API and the request callback described in the issue, then trace how current filters and sorting are held during table interactions. Done means ActionRef exposes the current filter and sort values so they can be reused as export parameters outside ProTable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100