如何在 sapui5 动态 table 上获取项目?
How can I get items on sapui5 dynamic table?
我已经创建了动态 table,但是当我试图显示组合框项目时我无法弄明白。这是问题和我的代码:
如上link或图片所示,我看不到项目,但实际上,结果是正确的(3 项),没有文字。我努力解决问题,但没有解决,如果你看到我想念的,请告诉我。
onCreateTable: function () {
var summaryDetailData = {
"subvariants": [{
"kontrolNesnesiTanim": "test 1 Tanım",
"kontrolNesnesiBelirtim": "test 1 Belirtim",
"kontrolSonucu": {
"test0": "test00",
"test1": "test10",
"test2": "test20",
},
"kontrolEdilecek": 20,
"kontrolEdilen": 0,
"icon": "sap-icon://accept"
}, {
"kontrolNesnesiTanim": "test 2 Tanım",
"kontrolNesnesiBelirtim": "test 2 Belirtim",
"kontrolSonucu": {
"test0": "test00",
"test1": "test10",
"test2": "test20",
"test3": "test30"
},
"kontrolEdilecek": 10,
"kontrolEdilen": 0,
"icon": "sap-icon://decline"
}, {
"kontrolNesnesiTanim": "test 3 Tanım",
"kontrolNesnesiBelirtim": "test 3 Belirtim",
"kontrolSonucu": {
"test0": "test00",
"test1": "test10",
"test2": "test20",
},
"kontrolEdilecek": 50,
"kontrolEdilen": 0,
"icon": "sap-icon://accept"
}, ]
};
var oTable = new sap.m.Table("idRandomDataTable", {
headerToolbar: new sap.m.Toolbar({
content: [new sap.m.Label({
text: ""
})]
}),
columns: [new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Kontrol Nesnesi"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Kontrol Sonucu"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Kontrol Edilecek"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Kontrol Edilen"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Durum/Değerlendirme"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Açıklama"
})
})]
});
this.getView().byId("SimpleFormChange480_TrialSonuc").addContent(oTable);
oTable.bindItems("/subvariants", new sap.m.ColumnListItem({
cells: [new sap.m.ObjectIdentifier({
title: "{kontrolNesnesiTanim}",
"titleActive": true,
text: "{kontrolNesnesiBelirtim}"
}),
new sap.m.ComboBox({
items: {
path: "kontrolSonucu/",
change:"onChange",
template: new sap.ui.core.Item({
key: "test01",
change:"onChange",
text: "{test0}"
})
},
change:"onChange",
})
// new sap.m.MultiInput({
// id:"multiInput3",
// showValueHelp:false
// })
, new sap.m.Input({
value: "{kontrolEdilecek}",
}), new sap.m.Input({
value: "{kontrolEdilen}"
}), new sap.ui.core.Icon({
src: "{icon}"
//text: "{Article}"
}), new sap.m.Input({
value: "",
// value: "{question}",
})]
}));
oTable.setModel(new sap.ui.model.json.JSONModel(summaryDetailData));
}
您有什么想法或建议吗?
谢谢。
我已经解决了问题
oTable.bindItems("/subvariants", new sap.m.ColumnListItem({
cells: [new sap.m.ObjectIdentifier({
title: "{kontrolNesnesiTanim}",
"titleActive": true,
text: "{kontrolNesnesiBelirtim}"
}),
new sap.m.ComboBox({
items: {
path: "kontrolSonucu/",
change:"onChange",
template: new sap.ui.core.Item({
key : "{}",
change:"onChange",
text: "{}"
})
},
change:"onChange",
})
正如你在上面看到的,我应该把文字写空 JSON,这样我才能看到所有项目。
谢谢。
我已经创建了动态 table,但是当我试图显示组合框项目时我无法弄明白。这是问题和我的代码:
如上link或图片所示,我看不到项目,但实际上,结果是正确的(3 项),没有文字。我努力解决问题,但没有解决,如果你看到我想念的,请告诉我。
onCreateTable: function () {
var summaryDetailData = {
"subvariants": [{
"kontrolNesnesiTanim": "test 1 Tanım",
"kontrolNesnesiBelirtim": "test 1 Belirtim",
"kontrolSonucu": {
"test0": "test00",
"test1": "test10",
"test2": "test20",
},
"kontrolEdilecek": 20,
"kontrolEdilen": 0,
"icon": "sap-icon://accept"
}, {
"kontrolNesnesiTanim": "test 2 Tanım",
"kontrolNesnesiBelirtim": "test 2 Belirtim",
"kontrolSonucu": {
"test0": "test00",
"test1": "test10",
"test2": "test20",
"test3": "test30"
},
"kontrolEdilecek": 10,
"kontrolEdilen": 0,
"icon": "sap-icon://decline"
}, {
"kontrolNesnesiTanim": "test 3 Tanım",
"kontrolNesnesiBelirtim": "test 3 Belirtim",
"kontrolSonucu": {
"test0": "test00",
"test1": "test10",
"test2": "test20",
},
"kontrolEdilecek": 50,
"kontrolEdilen": 0,
"icon": "sap-icon://accept"
}, ]
};
var oTable = new sap.m.Table("idRandomDataTable", {
headerToolbar: new sap.m.Toolbar({
content: [new sap.m.Label({
text: ""
})]
}),
columns: [new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Kontrol Nesnesi"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Kontrol Sonucu"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Kontrol Edilecek"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Kontrol Edilen"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Durum/Değerlendirme"
})
}), new sap.m.Column({
width: "2em",
header: new sap.m.Label({
text: "Açıklama"
})
})]
});
this.getView().byId("SimpleFormChange480_TrialSonuc").addContent(oTable);
oTable.bindItems("/subvariants", new sap.m.ColumnListItem({
cells: [new sap.m.ObjectIdentifier({
title: "{kontrolNesnesiTanim}",
"titleActive": true,
text: "{kontrolNesnesiBelirtim}"
}),
new sap.m.ComboBox({
items: {
path: "kontrolSonucu/",
change:"onChange",
template: new sap.ui.core.Item({
key: "test01",
change:"onChange",
text: "{test0}"
})
},
change:"onChange",
})
// new sap.m.MultiInput({
// id:"multiInput3",
// showValueHelp:false
// })
, new sap.m.Input({
value: "{kontrolEdilecek}",
}), new sap.m.Input({
value: "{kontrolEdilen}"
}), new sap.ui.core.Icon({
src: "{icon}"
//text: "{Article}"
}), new sap.m.Input({
value: "",
// value: "{question}",
})]
}));
oTable.setModel(new sap.ui.model.json.JSONModel(summaryDetailData));
}
您有什么想法或建议吗?
谢谢。
我已经解决了问题
oTable.bindItems("/subvariants", new sap.m.ColumnListItem({
cells: [new sap.m.ObjectIdentifier({
title: "{kontrolNesnesiTanim}",
"titleActive": true,
text: "{kontrolNesnesiBelirtim}"
}),
new sap.m.ComboBox({
items: {
path: "kontrolSonucu/",
change:"onChange",
template: new sap.ui.core.Item({
key : "{}",
change:"onChange",
text: "{}"
})
},
change:"onChange",
})
正如你在上面看到的,我应该把文字写空 JSON,这样我才能看到所有项目。
谢谢。