SAPUI5 Multimodel Binding -
i have problem multimodel binding.
in init function of controller set json model in ui.core
var omodel = new sap.ui.model.json.jsonmodel(data1); sap.ui.getcore().setmodel(omodel, "model1");
in view have template of columnlistitem , bind in table
var template = new sap.m.columnlistitem({ id: "first_template", type: "navigation", type : sap.m.listtype.active, visible: true, selected: true, cells: [ new sap.m.label({ text: "{name}" }) ], press: [ocontroller.presslistmethod] }); otable.binditems("model1>/events", template, null, null); opage.addcontent(otable);
with simple model work's rigth in multimodel table gets number of items not properties of model. solution ?
you need use model name in template, too:
var template = new sap.m.columnlistitem({ id: "first_template", type: "navigation", type : sap.m.listtype.active, visible: true, selected: true, cells: [ new sap.m.label({ text: "{model1>name}" // no leading "/" here since binding relative aggregation binding below }) ], press: ocontroller.presslistmethod }); otable.binditems("model1>/events", template); opage.addcontent(otable);
Comments
Post a Comment