sapui5 - Not able to create UI Controls at runtime -
i trying create screen on have panel. main panel has panel , panel has grid has 4 hboxes, , each hbox has button.
oninit:function(){ omainpanel.removeallcontent(); var ohbox1 = new sap.m.hbox(jquery.sap.uid()); var ohbox2 = new sap.m.hbox(jquery.sap.uid()); var ohbox3 = new sap.m.hbox(jquery.sap.uid()); var ohbox4 = new sap.m.hbox(jquery.sap.uid()); var opanel ; var ogrid; (var = 0; < 4; i++) { ogrid = new sap.ui.layout.grid(jquery.sap.uid(),{ hspacing: 1, vspacing: 1, content: [ohbox1,ohbox2,ohbox3,ohbox4] }); opanel = new sap.m.panel(jquery.sap.uid(),{ headertext: "some text", expandable: true, expanded: true, width:"100%", content:[ogrid] }); jquery.sap.delayedcall(100, this, function() { }); omainpanel.addcontent(opanel); } i can see content in each hbox, last panel. think these being overlapped. how can display content of hboxes in panels?.
you trying use same instances of hbox content of different grids. need create new instance each panel.
try doing like:
ogrid = new sap.ui.layout.grid(jquery.sap.uid(),{ hspacing: 1, vspacing: 1, content: [new sap.m.hbox(), new sap.m.hbox(), new sap.m.hbox(), new sap.m.hbox()] or initialize variables (ohbox1, ohbox2, etc) inside loop
Comments
Post a Comment