jQuery.sap.declare("com.resident.Component");
sap.ui.core.UIComponent.extend("com.resident.Component", {
metadata : {
rootView : "com.resident.residentbhartiya.App",
routing : {
config : {
targetsClass : "sap.m.routing.Targets",
viewPath : "com.resident.residentbhartiya",
controlId : "rootControl",
controlAggregation : "pages",
viewType : "JS"
},
targets : {
page1 : {
viewName : "loginpage",
viewLevel : 0
},
page2 : {
viewName : "homepage",
viewLevel : 1
}
}
}
},
init : function() {
sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
this.getTargets().display("page1");
},
});
Hi Priyanka,
please check the sample of mycomponent.js file.
jQuery.sap.declare("sap.claims.Component");
jQuery.sap.require("sap.ui.core.UIComponent");
new sap.ui.core.UIComponent.extend("sap.claims.Component",{
metadata:{
"includes": ["css/Style.css"],
dependencies: {
"libs": ["sap.m","sap.ui.commons","sap.ui.table"],
},
routing:{
config:{
viewType:"JS",
viewPath:"sap.claims.view",
targetControl:"appid",
clearTarget:false,
transition:"slide"
},
routes:[
{
pattern:"",
viewPath:"sap.claims.view",
name:"default",
view:"overview",
targetAggregation:"pages"
},
{
pattern:"create",
viewPath:"sap.claims.view",
name:"create",
view:"create",
targetAggregation:"pages"
},
]
},
},
init:function(){
jQuery.sap.require("sap.m.routing.RouteMatchedHandler");
jQuery.sap.require("sap.ui.core.routing.HashChanger");
sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
this._router = this.getRouter();
this._routeHandler = new sap.m.routing.RouteMatchedHandler(this._router);
this._router.initialize();
},
destroy : function() {
if (this.oRouteHandler) {
this.oRouteHandler.destroy();
}
sap.ui.core.UIComponent.prototype.destroy.apply(this, arguments);
var det3 = this._routeHandler.destroy();
delete det3;
},
createContent:function(){
var view = sap.ui.view({
viewName:"sap.claims.view.App",
type:"JS",
viewData:{Component:this}
})
return view;
}
})
Hope it will helps you..
Thanks,
Deepak.
Add a comment