Hi Pradeep!
Here's example of simple dynamic view in JavaScript. Can you implement it in XML?
CONTROLLER:
ap.ui.controller("sap.ui.simple.controller.JSView", { o_struct: { "panels": [ { number: 1, expandable : true, expanded : true, buttons:[ { text: "Hello!", press: "onShowHello" }, { text: "Bye!", press: "onShowBye" } ] }, { number: 2, expandable : true, expanded : false, buttons:[ { text: "1", press: "onShow1" }, { text: "2", press: "onShow2" }, { text: "3", press: "onShow3" } ] } ] }, onInit: function() {}
});
VIEW:
sap.ui.jsview("sap.ui.simple.view.JSView", { getControllerName: function() { return "sap.ui.simple.controller.JSView"; }, createContent: function(oController) { var o_data = oController.o_struct; var panels = []; var buttons = []; o_data.panels.forEach(function(panel, i){ buttons = []; panel.buttons.forEach(function(button, j){ buttons[j] = new sap.m.Button("SimpleButton_"+i+j, { text: button.text }); }); panels[i] = new sap.m.Panel("SimplePanel_"+i ,{ headerText: "Panel-" + panel.number, expandable: panel.expandable, expanded: panel.expanded, content: [buttons] }); }); var oBox = new sap.m.VBox("SimpleVBox", { items: [panels] }); var oPage = new sap.m.Page({ title:"Simple JSView", showNavButton:false, content: [oBox] }); return oPage; }
});If yes, then me would be very interested to see your solution!
