baidu/amis

table 已添加 `setExpanded` 动作,可以指定打开哪条数据,利用初始化动作可以走通这个场景

Opened this issue · 1 comments

          table 已添加 `setExpanded` 动作,可以指定打开哪条数据,利用初始化动作可以走通这个场景 

https://github.com/baidu/amis/pull/9910/files

Originally posted by @2betop in #9697 (comment)

          table 已添加 `setExpanded` 动作,可以指定打开哪条数据,利用初始化动作可以走通这个场景 

https://github.com/baidu/amis/pull/9910/files

Originally posted by @2betop in #9697 (comment)

在初始化数据的时候,设置select动作会生效,setExpanded动作却不生效 @2betop

{
  "body": [
    {
      "className": "mb-2",
      "label": "刷新 id 为 2 的行",
      "level": "primary",
      "onEvent": {
        "click": {
          "actions": [
            {
              "actionType": "setExpanded",
              "args": {
                "condition": "${id == 2}",
                "value": true
              },
              "componentId": "crud_reload1"
            }
          ]
        }
      },
      "type": "button"
    },
    {
      "api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/crud/table2",
      "bulkActions": [
        {
          "label": "批量操作",
          "onEvent": {
            "click": {
              "actions": [
                {
                  "actionType": "toast",
                  "args": {
                    "msg": "${ids}"
                  }
                }
              ]
            }
          },
          "type": "button"
        }
      ],
      "columns": [
        {
          "name": "id",
          "label": "ID"
        },
        {
          "name": "engine",
          "label": "Rendering engine"
        },
        {
          "name": "browser",
          "label": "Browser"
        }
      ],
      "id": "crud_reload1",
      "initFetch": true,
      "onEvent": {
        "fetchInited": {
          "actions": [
            {
              "actionType": "toast",
              "args": {
                "msg": "v"
              }
            },
            {
              "actionType": "select",
              "args": {
                "condition": "${id==2}"
              },
              "componentId": "crud_reload1"
            },
            {
              "actionType": "setExpanded",
              "args": {
                "condition": "${id==2}",
                "value": true
              },
              "componentId": "crud_reload1"
            }
          ]
        }
      },
      "syncLocation": false,
      "type": "crud"
    }
  ],
  "data": {
    "age": 18,
    "date": "2023-6-6",
    "name": "amis"
  },
  "type": "page"
}