问题描述
在下拉列表或单选按钮UI中获取所选项目的记录ID似乎是一个常见问题,但是尽管经过了数月的搜索,但我仍未找到Google AppMaker的答案.
Obtaining the record ID of the selected item in a drop-down list or radio-button UI appears to be a common question, but I have not found the answer for Google AppMaker despite months of searching.
示例用例:我是否要编辑属于某个家族的产品:
The example use case: is I wish to edit a product that belongs to a family:
产品-(N:1)->家庭
Product - (N:1) --> Family
产品-(M:N)-> FeatureValues
Product - (M:N) --> FeatureValues
该产品属于信用卡家族.
信用卡家族具有以下功能:|联系人|近场|费用|芯片和销|
The credit-card family has the following features: |Contactles|Near field|Rates|Chip & Pin|
在编辑表单中,如果我更改了产品所属的系列,则功能列表将更改,并且需要输入功能的新值. (动态形式)
In the edit form if I change the family the product belongs to then the list of features will change and new values for the features will need to be entered. (Dynamic form)
族,要素和允许的值保存在一个层次结构表中:
The family, features and permitted values are held in a single hierarchy table:
家庭|特征|值
Family|Features|Values
下拉列表:
widget.datasource.item.Id或_key 提供父数据源ProductById的产品ID(因为我正在编辑单个产品)
widget.datasource.item.Id or _key provides the Product ID of the parent data source, ProductById (because I am editing a single product)
widget.datasource.selectKey(newValue._key);返回未定义
widget.datasource.selectKey(newValue._key); returns undefined
示例代码
下拉列表 OnValueChange事件:
Sample code
Drop-down-listOnValueChange event:
app.datasources.TaxonomyChildren.load();
app.datasources.TaxonomyChildren.load();
如果我可以在下拉列表中选择所选族的记录ID,则可以设置query.filter.parameter来显示新选择的族的功能和值.
If I can pick up the record ID for the selected family in the dropdown list I can set a query.filter.parameter to show the features and values for the newly selected family.
注意:如果您无法在Google应用制造商中创建动态"表单,那么我会停下来,因为这已经用了很多时间.
Note: if it is a case you cannot create 'dynamic' forms in Google app-maker, then I'll stop as this has exhausted a lot of time.
推荐答案
大马库斯(Markus),行得通.在下拉ValueEdit事件中,我调用函数loadTaxonomyChildById(newValue.Id);.将选定的TaxonomyFamily的ID传递给它,从而更改显示的功能.
Great Markus, that worked. On the drop-down ValueEdit event I call the function loadTaxonomyChildById(newValue.Id); passing it the Id of the selected TaxonomyFamily, changing the features displayed.
这篇关于如何在Google App-maker的下拉列表中获取所选项目的记录ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!