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

Reusable view in UI5

$
0
0

Hi All,

 

I am trying to use one view as a reusable/subview in different views but whenever i use this view, it gives me duplicate text field etc error. I am wondering if anyone knows about it..

 

 

Use Case is :

 

I create one common view and add all the elements in that View Called skillsView

 

  1. sap.ui.jsview("persistence_with_jpa_ui.skillsView, {

     getControllerName : function() {

         return "persistence_with_jpa_ui.skillsView";

      },

     createContent : function(oController) {

     // here i add all the controls

var name = new sap.ui.commons.Link("nameLabel", {

                      text: "Name",

                      width: "200px",

                      enabled :false,

            });

 

 

Now i am using this view as a reuse/subview view in other views like

 

   2     Create Another view called ProfileView view and inside view i reuse skillsView

     sap.ui.jsview("persistence_with_jpa_ui.ProfileView", {

      getControllerName : function() {

         return "persistence_with_jpa_ui.ProfileView ";

      },

    

createContent : function(oController) {

              

      // now i am calling  skillsView here

                var view = sap.ui.view({

                                        id : "createContentView",

                                        viewName : "persistence_with_jpa_ui.skillsView",

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

                              });

                              return view;

 

    }

});

it works fine in this view and display all the controls

 

3) Now, i have created another view called Setting view and call the skills view inside

 

sap.ui.jsview("persistence_with_jpa_ui.SettingView", {

      getControllerName : function() {

         return "persistence_with_jpa_ui.SettingView";

      },

    

createContent : function(oController) {

         

      // now i am calling  skillsView here

          var view = sap.ui.view({

                   id : "createContentView",

                   viewName : "persistence_with_jpa_ui.skillsView",

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

               });

               return view;

 

    }

});

 

 

But at this point,, it gives me duplicate element "nameLabel" error on js console?

Any idea?


Viewing all articles
Browse latest Browse all 6178

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>