on 07-22-2018 2:44 PM
Hello Experts,
I had a query regarding components.js file. I have two pages page1 and page2. In page1 there are different button which we click and there is routing to the information of these button but the page remains the same, the URL gets appended with #action. However, I also need to do the routing to another page(page2) by clicking on another button(x1) with # in URL ..../#xx. This is my components.js file. Could you suggest me something?
component.js
jQuery.sap.declare("app.Component");
jQuery.sap.require("sap.ui.core.routing.Router");
sap.ui.core.UIComponent.extend("app.Component", {
metadata : {
routing: {
config: {
routerClass: "sap.ui.core.routing.Router",
viewType: "JS",
viewPath: "",
controlId: "container",
controlAggregation: "items",
transition: "slide",
async: true,
clearControlAggregation: true
},
routes: [{
pattern: ["", "button1action1"],
name: "action1",
target: "action1",
"controlAggregation": "content"
}, {
pattern: "button2action2",
name: "action2",
target: "action2",
controlAggregation: "content"
}],
targets: {
"action1": {
"viewName": "modules.action1.action1TestsView"
},
"action2": {
"viewName": "modules.action2.action2TestsView"
}
}
}
}, init : function() {
sap.ui.core.UIComponent.prototype.init.apply(this, arguments);
this.getRouter().initialize();
}, destroy : function() {
sap.ui.core.UIComponent.prototype.destroy.apply(this, arguments);
}, createContent : function() {
var oView = new sap.ui.jsview("xyz", "app.XYZView");
oView.setDisplayBlock(true);
return oView;
}
});
you can navigate by using the NavTo function of the Router
sap.ui.core.UIComponent.getRouterFor(this).navTo("action2", {... whatever arguments you want to pass... });
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.