Appmaker - 如何根据从 Appmaker 中的先前下拉列表中选择的选项填充数据源下拉列表中的选项?

Appmaker -How to populate options in dropdown from datasource based on the option selected from previous dropdown in Appmaker?

我有 2 个下拉菜单操作系统和 OS 版本。每个 OS 可以有多个 OS 版本,每个 OS 版本可以链接到多个 OS.

选择 OS 后,必须启用 OS 版本下拉列表,并且应根据 OS 从数据源中获取选项(OS 版本)以上选择。

我尝试使用查询脚本,但如何将客户端值(在 OS 中选择的选项,即 app.pages.RegisterServers.descendants.Dropdown8.value)传递给查询脚本?

Image of form for reference

在 OS 下拉菜单的 onClick 事件中,我添加了以下代码

   app.pages.RegisterServers.descendants.Dropdown9.enabled=true;
  app.datasources.OSVersion.query.parameters.os_name=
  app.pages.RegisterServers.descendants.Dropdown8.value;

并且在OS版本数据源的查询脚本中我添加了一个参数os_name。

查询脚本代码

  var osVersionResult = [];
 // Modify passed query to additionally filter by OS.
  query.filters.OpsName._equals=query.parameters.os_name;
  osVersionResult = query.run();
  return osVersionResult;

但这不起作用。如果您看到任何原因,请提出建议。

终于找到解决办法了!

在 OS 下拉列表的 OnValueChange 事件中添加了以下代码。就是这样,没有其他需要做的。

app.pages.RegisterServers.descendants.Dropdown9.enabled=true;
app.datasources.OSVersion.query.filters.OpsName._equals=
app.pages.RegisterServers.descendants.Dropdown8.value;
app.datasources.OSVersion.load();