Page 1 of 1

Backbutton Event affects all project

Posted: Wed Jun 03, 2015 9:05 pm
by Ingus Štāls7569555

Hello, Support!

I do not know if this is issue or misunderstanding, but when I in Pages add Event listener to Backbutton with Action Naigate to page x, this has been added to the whole project and also affects first page and it is impossible to exit from the application. I faund one workaraund by Your advice, but it is not the best pratice. Would it be must logically before navigating to page, remove this listener?

Thanks,
Ingus


Backbutton Event affects all project

Posted: Thu Jun 04, 2015 5:54 am
by Alena Prykhodko

Hello Ingus,

Please tell us exact steps to reproduce.
How do you add listener to Backbutton?


Backbutton Event affects all project

Posted: Thu Jun 04, 2015 6:21 am
by Ingus Štāls7569555

I have two pages - home and form. In the editor I navigate to the form page, then in Events section I select form page and from Events I select Backbutton and in Action I choose - Navigate to page.

Also I have second Event attached to this form, which is Device Ready and there I execute Javascript, which opens inAppBrowser and keep reference to add handlers for loadstop and exit.

In home page I have one Listener to the button which navigates me on the form page

Then I compile .apk and install to a device. I click my created button which navigates me to from page and form page launch inAppBrowser , then I close inAppBrowser with phone backButton and I navigate back to home page. When I try to click against phone back button on my home page there seems no action, but I espect to exit application.

I resolve my problem using this workaraund

var pagePathName= window.location.pathname;
var page = pagePathName.substring(pagePathName.lastIndexOf("/") + 1);
if(page == "Home.html") {
navigator.app.exitApp();
} else {
Apperyio.navigateTo("Home", {});
}


Backbutton Event affects all project

Posted: Thu Jun 04, 2015 3:40 pm
by Serhii Kulibaba

Hello Ingus,

As I can see you need custom logic. And you made it successfully, so use it if it works well.