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

弹窗内input-table无法更新数据 #9884

Closed
beloved-zh opened this issue Mar 26, 2024 · 0 comments · Fixed by #9941
Closed

弹窗内input-table无法更新数据 #9884

beloved-zh opened this issue Mar 26, 2024 · 0 comments · Fixed by #9941
Assignees
Labels
awaiting-release bug Something isn't working

Comments

@beloved-zh
Copy link

描述问题:

页面中的input-table编辑删除都可以更新数据
打开的弹窗内input-table无法更新数据

截图或视频:

如何复现(请务必完整填写下面内容):

  1. 你是如何使用 amis 的?
    sdk

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    最新版

  3. 粘贴有问题的完整 amis schema 代码:

{
  "type": "page",
  "title": "Excel导入",
  "body": [
    {
      "type": "button",
      "label": "打开弹窗",
      "onEvent": {
        "click": {
          "actions": [
            {
              "ignoreError": false,
              "actionType": "dialog",
              "dialog": {
                "type": "dialog",
                "title": "",
                "body": [
                  {
                    "type": "button",
                    "label": "设置数据",
                    "id": "u:c8415b69e8e2",
                    "onEvent": {
                      "click": {
                        "actions": [
                          {
                            "componentId": "u:c87dc1a04321",
                            "ignoreError": false,
                            "actionType": "setValue",
                            "args": {
                              "value": {
                                "table": "${[{\"a\":\"1\",\"b\":\"1\"},{\"a\":\"2\",\"b\":\"2\"}]}"
                              }
                            }
                          }
                        ]
                      }
                    }
                  },
                  {
                    "type": "button",
                    "label": "打印数据",
                    "onEvent": {
                      "click": {
                        "actions": [
                          {
                            "ignoreError": false,
                            "actionType": "toast",
                            "args": {
                              "msgType": "info",
                              "position": "top-right",
                              "closeButton": true,
                              "showIcon": true,
                              "msg": "${ENCODEJSON(table)}",
                              "className": "theme-toast-action-scope"
                            }
                          }
                        ]
                      }
                    },
                    "id": "u:ba07041c4235"
                  },
                  {
                    "type": "input-table",
                    "label": "表格表单",
                    "id": "u:7b76188d6f93",
                    "name": "table",
                    "columns": [
                      {
                        "label": "a",
                        "name": "a",
                        "quickEdit": {
                          "type": "input-text",
                          "name": "a"
                        },
                        "type": "text",
                        "id": "u:3313342080c4"
                      },
                      {
                        "label": "b",
                        "name": "b",
                        "quickEdit": {
                          "type": "input-text",
                          "name": "b"
                        },
                        "type": "text",
                        "id": "u:34d56f202552"
                      },
                      {
                        "type": "text",
                        "label": "c",
                        "name": "c",
                        "quickEdit": {
                          "type": "input-text",
                          "name": "c"
                        },
                        "id": "u:34d56f202552"
                      }
                    ],
                    "addable": false,
                    "footerAddBtn": {
                      "label": "新增",
                      "icon": "fa fa-plus"
                    },
                    "strictMode": true,
                    "minLength": 0,
                    "editable": true,
                    "removable": true,
                    "onEvent": {
                      "delete": {
                        "weight": 0,
                        "actions": []
                      }
                    }
                  }
                ],
                "showCloseButton": true,
                "showErrorMsg": true,
                "showLoading": true,
                "className": "app-popover :AMISCSSWrapper",
                "actions": [
                  {
                    "type": "button",
                    "actionType": "cancel",
                    "label": "取消",
                    "id": "u:1023b7bbe128"
                  },
                  {
                    "type": "button",
                    "actionType": "confirm",
                    "label": "确认",
                    "primary": true,
                    "id": "u:ff62c40091ec"
                  }
                ],
                "id": "u:c87dc1a04321",
                "closeOnOutside": false,
                "closeOnEsc": false,
                "draggable": false,
                "size": "lg",
                "withDefaultData": false,
                "dataMapSwitch": true,
                "data": {
                  "table": "${[]}"
                },
                "dataMap": {
                  "table": "${[]}"
                }
              }
            }
          ]
        }
      },
      "id": "u:4b8a4bd2ea85"
    },
    {
      "type": "button",
      "label": "设置数据",
      "onEvent": {
        "click": {
          "actions": [
            {
              "ignoreError": false,
              "actionType": "setValue",
              "args": {
                "value": {
                  "data": "${[{\"a\":\"1\",\"b\":\"1\"},{\"a\":\"2\",\"b\":\"2\"}]}"
                }
              },
              "componentId": "u:5c0ea7a16dc1"
            }
          ]
        }
      },
      "id": "u:6ffac4c4ffb7"
    },
    {
      "type": "button",
      "label": "打印数据",
      "id": "u:07d9ab56baba",
      "onEvent": {
        "click": {
          "actions": [
            {
              "ignoreError": false,
              "actionType": "toast",
              "args": {
                "msgType": "info",
                "position": "top-right",
                "closeButton": true,
                "showIcon": true,
                "msg": "${ENCODEJSON(data)}",
                "className": "theme-toast-action-scope"
              }
            }
          ]
        }
      }
    },
    {
      "type": "input-table",
      "name": "data",
      "label": "表格表单",
      "columns": [
        {
          "label": "a",
          "name": "a",
          "quickEdit": {
            "type": "input-text",
            "name": "a"
          },
          "type": "text",
          "id": "u:f445a81853b0"
        },
        {
          "label": "b",
          "name": "b",
          "quickEdit": {
            "type": "input-text",
            "name": "b"
          },
          "type": "text",
          "id": "u:78247d465dde"
        },
        {
          "type": "text",
          "label": "c",
          "name": "c",
          "quickEdit": {
            "type": "input-text",
            "name": "c"
          },
          "id": "u:320c56576226"
        }
      ],
      "addable": false,
      "footerAddBtn": {
        "label": "新增",
        "icon": "fa fa-plus"
      },
      "strictMode": true,
      "id": "u:5e74258b9227",
      "minLength": 0,
      "editable": true,
      "removable": true
    }
  ],
  "id": "u:5c0ea7a16dc1",
  "asideResizor": false,
  "pullRefresh": {
    "disabled": true
  },
  "regions": [
    "body"
  ],
  "data": {
    "data": "${[]}"
  }
}
  1. 操作步骤
    页面中点击设置数据然后修改数据后打印数据可以看到数据被修改
    弹窗内点击设置数据然后修改数据后打印数据是原始数据
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-release bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants