on 05-13-2015 7:10 AM
Hello experts,
I have created a menubar inside index.html (so that menu can be shown on every page or view). Now i want to navigate to another view after clikcing on menu Item. How do i do that? I am using routing also whose code is written inside component.js.
for eg:
Following is a function written inside some view's controller, when this function is called i navigate to orders view and address also changes. The same function how can be called from index? or any function for that matter?
onInit: function() {
this.router = sap.ui.core.UIComponent.getRouterFor(this);
}, // init function of view
handleOrder:function(evt) {
this.router.navTo("orders");
}, //called function
Regards,
Chetna
fire event in index.html and subscribe in that controller
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hie maksim,
I tried following thing:
var MenuItm1 = new sap.ui.commons.MenuItem({text:"Place Order",
select :function(oEvent) {
sap.ui.controller("demo.orders").handleStock();
},
});
orders.view:
onInit: function() {
this.router = sap.ui.core.UIComponent.getRouterFor(this);
handleStock: function(evt) {
alert("in handle stock");
this.router = sap.ui.core.UIComponent.getRouterFor(this);
this.router.navTo("StockStatus");
},
Though function gets called, but page does not navigate to another view and gives following error:
Cannot read property "navTo" of undefined.
Is there any way in which i can achieve navigation as well as routing in index.html
Regards,
Chetna
Will this help.
var MenuItm1 = new sap.ui.commons.MenuItem({text:"Place Order",
select :function(oEvent) {
sap.ui.controller("demo.orders").handleStock();
},
});
orders.view:
onInit: function() {
that = this;
this.router = sap.ui.core.UIComponent.getRouterFor(this);
handleStock: function(evt) {
alert("in handle stock");
that.router.navTo("StockStatus");
},
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.