Hi, I have a situation now where I need a method to execute instantly when the view is loaded for the second time without a need for controls to trigger it. Is there anyway i can do that?
Thanks in advance.
You'll need to track the state internally.
There are many ways to do this. Here's one:
CODE
_counter: 0,
_myMessage: function () {
log("################################################");
log("this is the second time the view has been loaded");
log("################################################");
},
updateView: function () {;
if (++this._counter === 2) {
this._myMessage();
}
}
Here's another:
CODE
_myMessage: function () {
log("################################################");
log("this is the second time the view has been loaded");
log("################################################");
},
updateView: function () {
if (!this._myMessage.counter) {
this._myMessage.counter = 0;
}
if (++this._myMessage.counter === 2) {
this._myMessage();
}
}