baidu / baidu/amis

CRUD表格的selectedChange问题

Open
#7,644 0 comments 0 reactions 1 assignee Claimed by @hsm-lv View on GitHub
feat
Dominant language
TypeScript
Stars
18.9k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

#### 描述问题:

CRUD表格使用selectedChange,在选中行的情况下是可以触发selectedChange事件,但是在keepItemSelectionOnPageChange为true的情况下,点击“清空“”文字后选中行被取消了,但是无法触发selectedChange事件

#### 截图或视频:

![QQ图片20230731221706](https://github.com/baidu/amis/assets/8375235/bde80592-0843-4a3d-b4db-da5d0b2bdc3c)

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

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

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

4. 粘贴有问题的完整 `amis schema` 代码:
```
{
"title": "浏览器内核对 CSS 的支持情况",
"remark": "嘿,不保证数据准确性",
"type": "page",
"body": {
"type": "crud",
"draggable": true,
"syncLocation": false,
"api": "/amis/api/mock2/sample",
"keepItemSelectionOnPageChange": true,
"autoGenerateFilter": true,
"onEvent": {
"selectedChange": {
"actions": [
{
"actionType": "toast",
"args": {
"msg": "已选择${event.data.selectedItems.length}条记录"
}
}
]
}
},
"bulkActions": [
{
"type": "button",
"label": "批量删除",
"actionType": "ajax",
"api": "delete:/amis/api/mock2/sample/${ids|raw}",
"confirmText": "确定要批量删除?"
},
{
"type": "button",
"label": "批量修改",
"actionType": "dialog",
"dialog": {
"title": "批量编辑",
"name": "sample-bulk-edit",
"body": {
"type": "form",
"api": "/amis/api/mock2/sample/bulkUpdate2",
"body": [
{
"type": "hidden",
"name": "ids"
},
{
"type": "input-text",
"name": "engine",
"label": "Engine"
}
]
}
}
}
],
"quickSaveApi": "/amis/api/mock2/sample/bulkUpdate",
"quickSaveItemApi": "/amis/api/mock2/sample/$id",
"headerToolbar": [
"bulkActions",
{
"type": "button",
"label": "重置测试数据",
"actionType": "ajax",
"size": "sm",
"api": "/amis/api/mock2/sample/reset"
},
"export-excel",
{
"type": "tpl",
"tpl": "一共有 ${count} 行数据。",
"className": "v-middle"
},
{
"type": "columns-toggler",
"align": "right",
"draggable": true
},
{
"type": "drag-toggler",
"align": "right"
}
],
"footerToolbar": [
"statistics",
"switch-per-page",
"pagination"
],
"columns": [
{
"name": "id",
"label": "ID",
"width": 20,
"sortable": true,
"type": "text",
"searchable": {
"type": "input-text",
"name": "id",
"label": "主键",
"placeholder": "输入id"
}
},
{
"name": "browser",
"label": "Browser",
"searchable": {
"type": "select",
"name": "browser",
"label": "浏览器",
"placeholder": "选择浏览器",
"options": [
{
"label": "Internet Explorer ",
"value": "ie"
},
{
"label": "AOL browser",
"value": "aol"
},
{
"label": "Firefox",
"value": "firefox"
}
]
}
},
{
"name": "platform",
"label": "平台",
"popOver": {
"trigger": "hover",
"body": {
"type": "tpl",
"tpl": "就是为了演示有个叫 popOver 的功能"
}
},
"sortable": true,
"type": "text"
},
{
"name": "grade",
"label": "CSS 等级",
"type": "select",
"options": [
"A",
"B",
"C",
"D",
"X"
]
},
{
"type": "operation",
"label": "操作",
"width": 100,
"buttons": [
{
"type": "button",
"actionType": "ajax",
"label": "删除",
"confirmText": "您确认要删除?",
"api": "delete:/amis/api/mock2/sample/$id"
}
]
}
]
}
}
```

5. 操作步骤
请简单描述一下复现的操作步骤...

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.