on 09-22-2016 8:23 AM
Hello,
I have 2 pages, Homepage and Splitpage. At Splitpage, I am fetching json from remote server and showing it's data using XML view. Problem is that controller method onInit() executes only once.
So if I go back to Home from Splitpage and navigates inside Splitpage again, it still shows old data. It does not fetches remote JSON data (I wrote that code in onInit() method). I also tested onBeforeRendering() method but it also behaves in the same way.
How to work around this issue ?
Thanks
Hi Ankur ,
Yeah its correct .. onInit() function is to just initialise the stuff. I hope you are using pattern matching routing , if yes than what you can do is attach function to Matched event of router ...
onInit: function () {
var oRouter = this.getRouter();
oRouter.getRoute("<splitApp view name>").attachMatched(this._onRouteMatched, this);
}
_onRouteMatched:function()
{
// here you can load your or fetch your data
}
thanks
Viplove
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
Instead of "<splitApp view name>" I have to write route name which I mentioned in manifest.json file.
callme: function(oEvent) {
console.log("Im inside callme()");
},
onInit: function(){
console.log('Started onInit');
var oRouter = this.getRouter();
oRouter.getRoute('appsplitpage').attachMatched(this.callme(), this);
},
Now in Chrome console, it is giving following error:
Started onInit
Im inside callme()
Uncaught TypeError: I.fFunction.call is not a function
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
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.