Quantcast
Channel: SCN : All Content - SAPUI5 Developer Center
Viewing all articles
Browse latest Browse all 6178

Can I create simple view Object and add controls/content to it

$
0
0

Hi All,

 

I want create simple view object and then try to add control in it as follows

var myView = new sap.ui.core.mvc.View();

for(var j=0;j<oModel.oData.Groups[i].Products.length;j++)

  {

                                        var detailView= sap.ui.view({

                                            viewName : "MyDirectory.CustomView",

                                            type : sap.ui.core.mvc.ViewType.JS

                                        });

                                        detailView.bindElement("/Groups/"+i+"/Products/"+j);

                                        myView.insertContent(detailView,j);

    }
myView.addStyleClass("productsContainer");

 

But when I create object "myView" it gives error:  Cannot read property 'viewData' of undefined

It never enter in for loop

 

Can any body show me how to create view object and Add content or control in it.


Viewing all articles
Browse latest Browse all 6178

Latest Images

Trending Articles



Latest Images