代码:
var text='<div data-sap-ui-type="sap.ui.commons.TextField" id="TF5" data-value="69190"></div>';
var myView = sap.ui.view({id:"myView",viewContent:text, type:sap.ui.core.mvc.ViewType.HTML});
myView.placeAt("content3");
这里我怎么能给占位符?
答案 0 :(得分:1)
你在使用JS视图吗?
TextFields有一个名为placheolder的属性,使用api引用来查找控件的属性:https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.commons.TextField.html#constructor
这将有效:
private void tabControl1_Selected(object sender, TabControlEventArgs e)
{
ListView listView = this.FindListView(e.TabPage.Controls);
}
private ListView FindListView(Control.ControlCollection controls)
{
ListView result = null;
foreach (Control control in controls)
{
result = control as ListView;
if (result == null)
{
result = FindListView(control.Controls);
}
if (result != null)
{
break;
}
}
return result;
}
答案 1 :(得分:1)
由于您使用的是HTML-Views,因此该解决方案应该有效:
var text = '<div data-sap-ui-type="sap.ui.commons.TextField" id="TF5" data-value="69190" data-placeholder="My Placeholder"></div>';
var myView = sap.ui.view({
id: "myView",
viewContent: text,
type: sap.ui.core.mvc.ViewType.HTML
});
myView.placeAt("content3");
答案 2 :(得分:0)