mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
fix: CRUD兼容actionType方式触发reload (#4448)
This commit is contained in:
parent
e435099576
commit
3fa85b0a9c
@ -2172,21 +2172,35 @@ crud 组件支持通过配置`headerToolbar`和`footerToolbar`属性,实现在
|
||||
}
|
||||
```
|
||||
|
||||
它其实是个简化的 `button` 组件,可以参考 `button` 组件的文档做调整,比如
|
||||
它其实是个简化的 `button` 组件,可以参考 `button` 组件的文档做调整。`reload`支持两种触发方式:
|
||||
|
||||
- `"type": "reload"`,CRUD 内置的方法
|
||||
- `{"actionType": "reload", "target": "targetName"}`,动作触发
|
||||
|
||||
```schema: scope="body"
|
||||
{
|
||||
"type": "crud",
|
||||
"name": "crud",
|
||||
"syncLocation": false,
|
||||
"api": "/api/mock2/sample",
|
||||
"headerToolbar": [
|
||||
{
|
||||
"type": "action",
|
||||
"align": "right",
|
||||
"icon": "iconfont icon-refresh",
|
||||
"label": "刷新(actionType)",
|
||||
"tooltip": "",
|
||||
"level": "primary",
|
||||
"actionType": 'reload',
|
||||
"target": 'crud'
|
||||
},
|
||||
{
|
||||
"type": "reload",
|
||||
"align": "right",
|
||||
"icon": "iconfont icon-refresh",
|
||||
"label": "刷新",
|
||||
"label": "刷新(type)",
|
||||
"tooltip": "",
|
||||
"level": "success"
|
||||
"level": "primary"
|
||||
}
|
||||
],
|
||||
"columns": [
|
||||
|
@ -670,6 +670,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
} else if (action.actionType === 'reload') {
|
||||
this.reload();
|
||||
} else if (
|
||||
pickerMode &&
|
||||
(action.actionType === 'confirm' || action.actionType === 'submit')
|
||||
|
@ -972,10 +972,7 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
return;
|
||||
}
|
||||
|
||||
onSaveOrder(
|
||||
movedItems,
|
||||
items
|
||||
);
|
||||
onSaveOrder(movedItems, items);
|
||||
}
|
||||
|
||||
syncSelected() {
|
||||
@ -2300,7 +2297,10 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
onClick={async () => {
|
||||
const {data, dispatchEvent} = this.props;
|
||||
|
||||
const allToggled = !(store.activeToggaleColumns.length === store.toggableColumns.length);
|
||||
const allToggled = !(
|
||||
store.activeToggaleColumns.length ===
|
||||
store.toggableColumns.length
|
||||
);
|
||||
const rendererEvent = await dispatchEvent(
|
||||
'columnToggled',
|
||||
createObject(data, {
|
||||
@ -2341,9 +2341,11 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
key={column.index}
|
||||
onClick={async () => {
|
||||
const {data, dispatchEvent} = this.props;
|
||||
let columns = store.activeToggaleColumns.map(item => item.pristine);
|
||||
let columns = store.activeToggaleColumns.map(
|
||||
item => item.pristine
|
||||
);
|
||||
if (!column.toggled) {
|
||||
columns.push(column.pristine)
|
||||
columns.push(column.pristine);
|
||||
} else {
|
||||
columns = columns.filter(c => c.name !== column.pristine.name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user