【问题标题】:Is there a way to access the fields of a record, selected by a radio button widget in Google App Maker?有没有办法访问由 Google App Maker 中的单选按钮小部件选择的记录字段?
【发布时间】:2019-03-28 19:04:17
【问题描述】:

总结

我对 AppMaker 相当陌生,这个问题集中在层次结构上。我有一个分类表,它有一个直接的父级有子级层次关系。

TaxonomyGroup -> 有很多特征 -> 有很多值

我一直在研究一种使用 tile/grid 小部件来遍历此层次结构的方法。

当我到达树结构的最后一个节点时,我将其显示为一组单选按钮,代表允许的选项。

示例

起始组是:汽车

汽车具有以下功能:

-颜色 -红色的 -蓝色的 -银 -绿色

-传输 -自动的 -手动

-燃料 -汽油 -杂交种 -电动

如果父组是摩托车,我会有一组不同的功能和选项(允许的值)。

用户为汽车选择以下内容:

+颜色 -银

+翻译 -自动

+燃料 -电动

问题

虽然我可以选择 Silver、Automatic、Electric 作为所选选项,但我无法选择 ID 或所选单选按钮所代表的记录的任何其他字段。

网格小部件设置

Taxonomy Grid Panel..... 父层 DS = Taxonomy (table) Id In [list]

Taxonomy Grid 子面板 'child' 层 DS = TaxonomyChildren, ParentId = :parent

单选按钮列表 DS = TaxonomyChildren:子组(关系)

注意,单选按钮列表位于 Taxonomy Grid Child 面板中,因此选项列表会根据功能发生变化。

单选按钮代码 onValueEdit 事件

// provides the row index of the selected Feature. e.g 'Transmission'

var rowIndex = widget.root.descendants.TaxonomyChildGridPanel.selectedIndex;

if (rowIndex === 0 ){   
 widget.root.descendants.Feature1.ID = widget.datasource.item.Id;
} else if rowIndex ===1 { 
 widget.root.descendants.Feature2.ID = widget.datasource.item.Id;
  }
: //etc etc   
}

单选按钮小部件问题

widget.datasource.item.Id

仅返回单选按钮列表中第一项的 ID。

例如记录 ID 117 表示选项“汽油”而不是电动作为选择的单选按钮选项。

我需要能够捕获单选按钮选择背后的记录,表示树结构的节点(称为值)。特别是记录的 ID。然后在创建新记录时存储它,在本例中为新的汽车记录。

目前:onValueEdit 事件:提供了错误的 record_ID,它始终是单选按钮列表中的第一个选项,无论选择了哪个选项。

屏幕截图

Grid panels for hierarchy levels 1 & 2, Radio buttons represent values

Hierarchy view with data

【问题讨论】:

  • 我想我理解你的问题,但它让我很困惑。也许您应该考虑添加一些视觉辅助工具。几个屏幕截图应该可以帮助我们更好地理解。
  • 感谢您的评论。添加图片以说明浏览层次结构和收集输入值的意图。收集值的形式是动态的,因为特征因父组而异。

标签: radio-button hierarchy hierarchical-data google-app-maker


【解决方案1】:

有关此问题的解决方法,请参阅以下问题的答案:

[How to obtain the record ID of the selected item in a dropdown list in google app-maker

即:单选按钮选择的onValueEdit事件记录id可以使用newValue获得。对于勾选框,它是 newValues,它根据勾选的项目构建一个答案数组。

if (!newValue) {
   return;
} else {
   answersDS.query.parameters.answerListIDs.push(newValue);
   answersDS.load();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-01-02
    • 1970-01-01
    • 1970-01-01
    • 2012-02-16
    • 1970-01-01
    • 1970-01-01
    • 2011-05-16
    • 2020-12-24
    相关资源
    最近更新 更多