我想绑定数组"机器"它嵌套在我的模型中,用于SAPUI5 sap.m.TileContainer。
var data_main = {
"name":"1",
"company":{
"money":100000,
"name":"2",
"departments":{
"marketing":{
"marketingActivities":[
],
"marketingModifier":0,
"numberOfEmployees":1
},
"production":{
"output":14281.287062979532,
"outputCoefficientOfEmployees":10,
"machines":[
{
"priceForNextUpdate":0,
"effectOnOutput":200,
"level":1,
"price":0,
"name":"lauterTub",
"id":1,
"value":2000,
"costPerRound":100
},
{
"priceForNextUpdate":0,
"effectOnOutput":500,
"level":1,
"price":0,
"name":"fermantingVat",
"id":2,
"value":5000,
"costPerRound":200
},
{
"priceForNextUpdate":0,
"level":0,
"price":0,
"effectOnCapacity":0,
"name":"storage",
"id":3,
"value":0,
"costPerRound":0
},
{
"priceForNextUpdate":0,
"effectOnQuality":0,
"level":0,
"price":0,
"name":"beerFilter",
"id":4,
"value":0,
"costPerRound":0
},
{
"priceForNextUpdate":0,
"effectOnOutput":300,
"level":1,
"price":0,
"name":"brewingCopper",
"id":5,
"value":3000,
"costPerRound":200
},
{
"priceForNextUpdate":0,
"effectOnOutput":200,
"level":1,
"price":0,
"name":"mashTub",
"id":6,
"value":2000,
"costPerRound":50
},
{
"priceForNextUpdate":0,
"effectOnQuality":0,
"level":0,
"price":0,
"name":"whirlpool",
"id":7,
"value":0,
"costPerRound":0
},
{
"priceForNextUpdate":0,
"effectOnOutput":100,
"level":1,
"price":0,
"name":"maltMill",
"id":8,
"value":1000,
"costPerRound":50
}
],
"numberOfEmployees":2,
"quality":0,
"capacity":0
},
"procurement":{
"numberOfEmployees":1
},
"sales":{
"numberOfEmployees":2
}
},
"numberOfEmployees":6
},
"publicData":{
"markt":"Beispieleigenschaft des Marktes"
}
}
var model_main = new sap.ui.model.json.JSONModel(data_main);
sap.ui.getCore().setModel(model_main, "main");

在我看来:
new sap.m.TileContainer("tilecontainer_production", {
width: "55em",
height: "35em",
editable: true,
allowAdd: true,
tiles: {
path: "main>/company/departments/production/machines",
template: new sap.m.CustomTile({...})
)};

但没有任何作用。我试图将它绑定到
但没有任何作用。
先谢谢,我真的被卡住了!
答案 0 :(得分:2)
编辑: 我犯了一个错误。
这是正确的解决方案:
您错过了路径中的 / 使用“modelname”> / so main> / 访问模型中的属性 是绑定路径的开始
main>/company/departments/production/machines
祝你好运