Reputation: 301
I am trying to set it so that when I close my modal window it changes the page it is going back to using $.viewContainer.scrollToView(2); how can I don this? I open my modal using this:
$.Login2.addEventListener("click", function() {
var Login = Alloy.createController('Login').getView();
Login.open({
modal : true,
});
});
and inside my modal I close it using this:
$.closeLogin.addEventListener("click", function() {
$.Login.close();
});
on close I would like it to set the view of scrollableView of the page that opened it to view 2.
Upvotes: 0
Views: 173
Reputation: 1960
You need to pass a callback to your Login controller which you will then call in your $.closeLogin click eventlistener, e.g.:
Index.js:
function doSomething(){
$.viewContainer.scrollToView(2);
}
$.Login2.addEventListener("click", function() {
var Login = Alloy.createController('Login', {'cb':doSomething}).getView();
Login.open({
modal : true,
});
});
Test.js:
var args = arguments[0] || {};
$.closeLogin.addEventListener("click", function() {
$.Login.close();
args.cb();
});
Upvotes: 1