如何在Google App-maker的下拉列表中获取所选项目的记录ID [英] How to obtain the record ID of the selected item in a dropdown list in google app-maker

查看:113
本文介绍了如何在Google App-maker的下拉列表中获取所选项目的记录ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在下拉列表或单选按钮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

newValue._key似乎仅适用于文本框UI项.

newValue._key appears to only work for text-box UI items.

下拉列表:

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-list OnValueChange event:

//根据所选分类标准家族更新功能下拉列表 app.datasources.TaxonomyChildren.query.parameters.parent_fk = app.datasources.TaxonomyFamilies.item.Id;

//update the features drop-down based on the taxonomy family selected app.datasources.TaxonomyChildren.query.parameters.parent_fk = app.datasources.TaxonomyFamilies.item.Id;

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.

推荐答案

马库斯写道: 因此,保留选项和值设置,但在onValueEdit中,将 newValue.id 传递给查询

Markus wrote: So leave the options and value settings but in the onValueEdit run your query against TaxonomyChildren by passing in newValue.id to the query

大马库斯(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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆