如何访问 appmaker 中列表行中存在的已启用 属性 元素?

How to access enabled property of elements present inside a list row in appmaker?

我有一个列表,其中 listRow 包含一个面板。然后,面板内有 3 个文本字段。我想通过代码禁用这 3 个文本字段,但问题是我无法访问这 3 个文本字段的已启用 属性。

我尝试了以下方法无济于事:

var x=app.currentPage.descendants.FileList.descendants._values;

有什么想法吗?

我会尝试以下代码:

var listRow = app.currentPage.descendants.FileList.children._values;
for (var i in listRow) {
  var inputs = listRow[i].YourPanelName.children._values;
  for (var j in inputs) {
    inputs[j].enabled = false;
  }
}

基本上,您首先必须访问列表小部件的子项,即列表行,然后对于每个列表行,您可以通过调用面板的名称然后调用其中的子项来引用每一行中的面板那个面板是你的输入。这就是为什么这需要一个嵌套循环。我没有对此进行测试,但它应该可以工作。

根据 List Widget 文档,属性 table 解释:

descendants - All the children of this Layout widget recursively, identified by their names. This excludes any repeated children, such as rows in a List, cells in a Grid, Accordion, and their content.

因此,使用后代肯定不会给你想要的。而且,还说明了:

children - The direct children of this Layout widget, identified by their names.

这里,不是指定排除重复的子项,因为列表中的每一行项都是重复的子项,那么这就是我们需要使用的选项。

现在,调用子项会给我们一个 PropertyMap,因此我们需要通过调用 PropertyMap 值来遍历每个项目。所以你需要这样做:

var rows = app.currentPage.descendants.FileList.children._values;
rows.forEach(function(row){
    var rPanel = row.descendants.[PanelWidgetName];
    var panelDescs = rPanel.descendants.
    panelDescs.forEach(function(desc){
        desc.enabled = true; //false
    });
});