如何在sapui5动态表上获取项目?

问题描述 投票:0回答:1

我已经创建了动态表,但是当我试图显示组合框项目时,我无法理解它。这是问题和我的代码:

正如你在上面看到的链接或图片,我看不到这些项目,但实际上,结果是真的(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));
        }

你有什么想法或建议吗?

谢谢。

combobox sapui5 dynamic-tables
1个回答
0
投票

我已经解决了这个问题

    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,所以我可以看到所有项目。

不管怎么说,还是要谢谢你。

© www.soinside.com 2019 - 2024. All rights reserved.