baidu / baidu/amis

使用table2表格,工具栏添加右对齐的按钮,按钮执行“清除选中项”事件 无效

Open
#11,596 2 comments 0 reactions 0 assignees View on GitHub
feat need confirm style
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

![Image](https://github.com/user-attachments/assets/273d42bc-10f9-4506-9ccf-89cb2a88b543)

右侧属性:
1.开启 简单查询
2.工具栏添加按钮 右对齐
3.点击按钮事件: 删除表格选中项
代码如下:{
"type": "crud2",
"id": "u:d7852ebd4804",
"mode": "table2",
"dsType": "api",
"syncLocation": true,
"primaryField": "id",
"loadType": "pagination",
"headerToolbar": [
{
"type": "flex",
"direction": "row",
"justify": "flex-start",
"alignItems": "stretch",
"style": {
"position": "static",
"flexWrap": "nowrap",
"justifyContent": "flex-end",
"flexDirection": "row-reverse"
},
"items": [
{
"type": "container",
"align": "left",
"behavior": [
"Insert",
"BulkEdit",
"BulkDelete"
],
"body": [
{
"type": "button",
"label": "按钮",
"behavior": "custom",
"className": "m-r-xs",
"onEvent": {
"click": {
"actions": [
{
"componentId": "u:d7852ebd4804",
"groupType": "component",
"ignoreError": true,
"actionType": "clearAll"
}
]
}
},
"id": "u:4b936e2f9019",
"disabledOnAction": false
}
],
"wrapperBody": false,
"style": {
"flexGrow": 1,
"flex": "1 1 auto",
"position": "static",
"display": "flex",
"flexDirection": "row",
"flexWrap": "nowrap",
"alignItems": "stretch",
"justifyContent": "flex-end"
},
"id": "u:f2743cdb80d0",
"isFixedHeight": false
}
],
"id": "u:04bd6cbaaeb5",
"isFixedHeight": false,
"isFixedWidth": false
}
],
"footerToolbar": [
{
"type": "flex",
"direction": "row",
"justify": "flex-start",
"alignItems": "stretch",
"style": {
"position": "static",
"flexWrap": "nowrap"
},
"items": [
{
"type": "container",
"align": "right",
"body": [
{
"type": "pagination",
"behavior": "Pagination",
"layout": [
"total",
"perPage",
"pager"
],
"perPage": 10,
"perPageAvailable": [
10,
20,
50,
100
],
"align": "right",
"id": "u:79fd08f6262a"
}
],
"wrapperBody": false,
"style": {
"flexGrow": 1,
"flex": "1 1 auto",
"position": "static",
"display": "flex",
"flexBasis": "auto",
"flexDirection": "row",
"flexWrap": "nowrap",
"alignItems": "stretch",
"justifyContent": "flex-end"
},
"id": "u:ac52163031e8"
}
],
"id": "u:a2288e4a63fe",
"isFixedHeight": false,
"isFixedWidth": false
}
],
"columns": [
{
"type": "tpl",
"title": "字段1",
"name": "id",
"id": "u:2a9d6c40ee49"
},
{
"type": "tpl",
"title": "字段2",
"name": "id1",
"id": "u:45b92a0aaa4a"
},
{
"type": "tpl",
"title": "字段3",
"name": "id2",
"id": "u:a4a0017ff2fa"
},
{
"type": "tpl",
"title": "字段4",
"name": "id3",
"id": "u:015840568446"
},
{
"type": "tpl",
"title": "字段5",
"name": "id4",
"id": "u:a93209ea641f"
},
{
"type": "tpl",
"title": "字段6",
"name": "id5",
"id": "u:9770e535f41e"
}
],
"editorSetting": {
"mock": {
"enable": true,
"maxDisplayRows": 5
}
},
"filter": {
"type": "form",
"title": "条件查询",
"mode": "inline",
"columnCount": 3,
"clearValueOnHidden": true,
"behavior": [
"SimpleQuery"
],
"body": [
{
"name": "id",
"label": "字段1",
"type": "input-text",
"size": "full",
"required": false,
"behavior": "SimpleQuery",
"id": "u:51a88030f391"
},
{
"name": "id1",
"label": "字段2",
"type": "input-text",
"size": "full",
"required": false,
"behavior": "SimpleQuery",
"id": "u:2e04cf91ea93"
},
{
"name": "id2",
"label": "字段3",
"type": "input-text",
"size": "full",
"required": false,
"behavior": "SimpleQuery",
"id": "u:655fd8134037"
},
{
"name": "id3",
"label": "字段4",
"type": "input-text",
"size": "full",
"required": false,
"behavior": "SimpleQuery",
"id": "u:6bc0f52e9ae4"
},
{
"name": "id4",
"label": "字段5",
"type": "input-text",
"size": "full",
"required": false,
"behavior": "SimpleQuery",
"id": "u:3dc3ae95e92f"
},
{
"name": "id5",
"label": "字段6",
"type": "input-text",
"size": "full",
"required": false,
"behavior": "SimpleQuery",
"id": "u:2d24d0061505"
}
],
"actions": [
{
"type": "reset",
"label": "重置",
"id": "u:d7b02dfe3817"
},
{
"type": "submit",
"label": "查询",
"level": "primary",
"id": "u:2cb74bcd2fbb"
}
],
"id": "u:6e55ce325078",
"feat": "Insert"
},
"rowSelection": {
"type": "checkbox",
"keyField": "id"
},
"api": {
"url": "https://xxxxxxxxxxxxx/list",
"method": "post",
"requestAdaptor": "",
"adaptor": "",
"messages": {}
},
"multiple": true
}
删除表格选中项 事件 并没有生效

Contributor guide

No contributing guide indexed for this repository

Research direction

Use the supplied table2/crud2 JSON to reproduce the issue, focusing on the custom button's clearAll action and the table's rowSelection configuration. Trace the table2 event handling and verify that clicking the button clears the selected rows; done means the selected items are visibly unselected.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.