错误sap.m.list BindAggregation

时间:2017-04-20 09:16:15

标签: javascript sap sapui5

我是sapui5的新手,我试图动态绑定sap.m.list但是列表中没有显示数据而且我没有解决这个问题

有我的代码:

_bindfilter: function(Filter) {

        var oList = this.getView().byId("list");
        var array = [];


        array.push(Filter);
        var Filter2 = {"metadata" : array } ; 
        oList.setModel(new sap.ui.model.json.JSONModel(array));


       var oTemplate = new sap.m.InputListItem({
                label: "{NameF0}",
                 content: [ new sap.m.Button("but4", {text:"Button4"})]


        });
        oList.bindAggregation("items","/array", oTemplate); 


    oList.setBusy(false);
    debugger;
    },

我向方法传递了一个参数,我想让它显示在列表中

此图显示了调试器enter image description here

中包含数据的参数

我真的被困了,我需要你的帮助,请随时帮助我 最诚挚的问候

1 个答案:

答案 0 :(得分:1)

您尝试将数组绑定到这是错误的,因为sap.m.List没有聚合,因为您可以看到here。相反,您可以绑定到,因此您的oTemplate应该将类型更改为sap.m.Column。但是,似乎不推荐使用绑定到列,因此您应该使用sap.m.Table而不是sap.m.List

关于绑定的好解释是here,但我希望你已经去过那里。

相关问题