baidu / baidu/amis

Picker的内嵌模式,值不继承父组件而被置为空,导致表格数据没有默认被选择;

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

Description

#### 描述问题:
Picker的内嵌模式,值不继承父组件而被置为空,导致表格数据没有默认被选择;
非内嵌模式值继承父组件,无此问题

#### 截图或视频:
![image](https://user-images.githubusercontent.com/79636715/123201003-770e7400-d4e4-11eb-9030-1ca5cc560ce1.png)
![image](https://user-images.githubusercontent.com/79636715/123201029-7f66af00-d4e4-11eb-8895-0dc034b1fad6.png)
![image](https://user-images.githubusercontent.com/79636715/123200825-1121ec80-d4e4-11eb-88ca-959bfc59f39a.png)

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

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

2. 粘贴有问题的完整 `amis schema` 代码:
```
{
"type": "page",
"body": {
"type": "form",
"name": "form1",
"debug": true,
"initApi": {
"method": "get",
"url": "/mock/blank.json",
"data": { "&": "$$" },
"requestAdaptor": "console.log(api);return api;",
"adaptor": "console.log(api);if(api.query['row']){api.query['table1']?payload['table1']=api.query['table1']:payload['table1']=[];payload['table1'].push(api.query['row']);}return payload;"
},
"controls": [
{
"type": "table",
"name": "table1",
"addable": true,
"editable": true,
"removable": true,
"columns": [{
"name": "label", "label": "Name"
}, {
"name": "position", "label": "Title"
}]
},
{
"type": "action",
"label": "穿梭器提交到表格",
"actionType": "drawer",
"drawer": {
"title": "表格2",
"body": {
"type": "form",
"name": "form2",
"target": "form1",
"controls": [{
"label": false,
"type": "transfer",
"name": "table1",
"source": "get:/mock/picker_ajax.json",
"selectMode": "table",
"joinValues": false,
"columns": [
{
"name": "label",
"label": "英雄"
},
{
"name": "position",
"label": "位置"
}
]
}]
}
}
},
{
"type": "action",
"label": "表单提交到表格",
"actionType": "drawer",
"drawer": {
"title": "表格2",
"body": {
"type": "form",
"name": "form3",
"debug": true,
"target": "form1",
"controls": [
{
"type": "text",
"name": "row.label",
"label": "英雄"
},
{
"type": "text",
"name": "row.position",
"label": "位置"
},
{
"type": "table",
"name": "row.table",
"addable": true,
"editable": true,
"removable": true,
"columns": [{
"name": "id", "label": "id"
}, {
"name": "name", "label": "name"
}]
}
]
}
}
},
{
"type": "action",
"label": "Picker提交到表格",
"actionType": "drawer",
"drawer": {
"title": "请选择",
"data":{"&":"$$","tableFixBug":"${table1}"},
"body": {
"type": "form",
"name": "form4",
"debug": true,
"target": "form1",
"controls": [
{
"label": false,
"type": "picker",
"name": "table1",
"joinValues": false,
"embed": false,
"multiple": true,
"source": "get:/mock/picker_ajax.json",
"pickerSchema": {
"mode": "table",
"name": "thelist",
"draggable": true,
"primaryField": "label",
"headerToolbar": {
"wrapWithPanel": false,
"type": "form",
"className": "text-right",
"target": "thelist",
"mode": "inline",
"controls": [
{
"type": "text",
"name": "keywords",
"addOn": {
"type": "submit",
"label": "搜索",
"level": "primary",
"icon": "fa fa-search pull-left"
}
}
]
},
"columns": [
{
"type": "text",
"name": "label",
"label": "英雄",
"sortable": true,
"toggled": true
},
{
"type": "text",
"name": "position",
"label": "位置",
"sortable": true,
"toggled": true
}
]
}
}
]
}
}
}
]
}
}
```

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

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the supplied SDK schema, focusing on the embedded Picker, its parent form data, and the table1 target. Compare embedded and non-embedded behavior; done means the Picker inherits the parent value and the table displays the expected default selected rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.