cancel
Showing results for 
Search instead for 
Did you mean: 

How to give an Static ID to view in sapui5 Kapsel Master Template?

Former Member
0 Kudos

Hi all,

i am developing an sapui5 application using kapsel master while i am creating multiple views it is generating dynamic id's like __xmlview1,__xmlview2

like this while i am accesing components in views i need to call like this __xmlview4--frgament--componentid ,

but problem is __ xmlview4 is not static, it is generated  dynamically so some times i am unable to access the components how can i rectify this problem or how to give static id's for views.

Thanks,

Kotesh.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can give id's from component.js.

please check below to give unique id's

SAPUI5 SDK - Demo Kit

If you want to give unique id to views from Component.js , you can try

var oView = sap.ui.view({

         id : "idApp",

         viewName : "test.view.App",

            type : "JS",

            viewData : { component : this }

        });

Regards,

Koti Reddy

Former Member
0 Kudos

Hi Koti Reddy,

i am using following code in my controller of instantiating view

onInit: function() {

  this.getRouter().attachRouteMatched(this.onRouteMatched, this);

  },

so it gives an error like

Uncaught TypeError: Cannot read property 'attachRouteMatched' of undefined

i am getting this as present view but it gives error for above statement i mean this.getRouter() gives undefined only in this scenario otherwise it is working fine and gives an dynamic id.

Thanks,

Kotesh.