如何在我的控制器中使用 select 控件?
how do I use select control in my controller?
我正在尝试在我的控制器中定义 select 控件,但它不起作用。我希望 select 控件具有默认值 {garows>Type} 并显示包含问题、答案和按钮的下拉列表。
这是我目前尝试过的方法。 select 是 ColumnListItem 中的第三个控件。其他一切正常。
this.setModel(new JSONModel({
"type": {
"answer": "Answer",
"button": "Button",
"question": "Question"
}
}), "typDropDown");
var item = new Item({
text: "{garows>/Type}"
});
var oTable = this.byId("gaTable");
oTable.setMode("None");
oTable.bindItems({ //changes the table for guided assistance qa to editable
path: "garows>/flow",
template: new ColumnListItem({
cells: [
new Text({
text: "{garows>ID}"
}),
new TextArea({
value: "{garows>value_long}",
growing: true,
growingMaxLines: 7
}),
new Select({
autoAdjustWidth: true
}).bindAggregation("items", "typDropDown>/type", item),
new TextArea({
value: "{garows>Action}"
}),
new TextArea({
value: "{garows>Button1}"
}),
new TextArea({
value: "{garows>Button2}"
}),
new TextArea({
value: "{garows>Button3}"
}),
new TextArea({
value: "{garows>Button4}"
}),
new TextArea({
value: "{garows>Button5}"
}),
new TextArea({
value: "{garows>Button6}"
}),
new TextArea({
value: "{garows>Active_Flag}"
})
]
}),
key: "ID"
}).setKeyboardMode("Edit");
预期结果是,select 控件将具有默认值 {garows>Type} 并显示包含问题、答案和按钮的下拉列表。如果有任何帮助,我将不胜感激。
在你的 bindAgregation 上它应该是
.bindAggregation("items", "garows>/type", item) right?
您使用了不同的模型 (typDropDown)。
我认为您的 typDropDown 的数据结构不正确 - 它需要是一个数组而不是聚合绑定的对象映射。
如果我对你的理解正确,你需要将项目聚合绑定到 typDropDown 模型(它需要是一个数组)并且你想将 Select 的 selectedKey 属性 绑定到garows 模型中的值。
所以在我看来,您需要更改 typeDropDown 的数据结构和项目模板,并且您需要绑定 selectedKey。
我正在尝试在我的控制器中定义 select 控件,但它不起作用。我希望 select 控件具有默认值 {garows>Type} 并显示包含问题、答案和按钮的下拉列表。
这是我目前尝试过的方法。 select 是 ColumnListItem 中的第三个控件。其他一切正常。
this.setModel(new JSONModel({
"type": {
"answer": "Answer",
"button": "Button",
"question": "Question"
}
}), "typDropDown");
var item = new Item({
text: "{garows>/Type}"
});
var oTable = this.byId("gaTable");
oTable.setMode("None");
oTable.bindItems({ //changes the table for guided assistance qa to editable
path: "garows>/flow",
template: new ColumnListItem({
cells: [
new Text({
text: "{garows>ID}"
}),
new TextArea({
value: "{garows>value_long}",
growing: true,
growingMaxLines: 7
}),
new Select({
autoAdjustWidth: true
}).bindAggregation("items", "typDropDown>/type", item),
new TextArea({
value: "{garows>Action}"
}),
new TextArea({
value: "{garows>Button1}"
}),
new TextArea({
value: "{garows>Button2}"
}),
new TextArea({
value: "{garows>Button3}"
}),
new TextArea({
value: "{garows>Button4}"
}),
new TextArea({
value: "{garows>Button5}"
}),
new TextArea({
value: "{garows>Button6}"
}),
new TextArea({
value: "{garows>Active_Flag}"
})
]
}),
key: "ID"
}).setKeyboardMode("Edit");
预期结果是,select 控件将具有默认值 {garows>Type} 并显示包含问题、答案和按钮的下拉列表。如果有任何帮助,我将不胜感激。
在你的 bindAgregation 上它应该是
.bindAggregation("items", "garows>/type", item) right?
您使用了不同的模型 (typDropDown)。
我认为您的 typDropDown 的数据结构不正确 - 它需要是一个数组而不是聚合绑定的对象映射。
如果我对你的理解正确,你需要将项目聚合绑定到 typDropDown 模型(它需要是一个数组)并且你想将 Select 的 selectedKey 属性 绑定到garows 模型中的值。
所以在我看来,您需要更改 typeDropDown 的数据结构和项目模板,并且您需要绑定 selectedKey。