Add onbackclick support for title bar to hook custom logic to the titlebar back button #771

Closed
wants to merge 3 commits into
from

Projects

None yet

2 participants

@xqliu
xqliu commented Mar 28, 2013

This commit is created to add a custom onbackclick attribute for titlebar,

The logic is

  • If there's no onbackclick attribute defined for the titlebar, then bb.pushScreen() will be invoked, that's the same as former behavior.

  • If there's any onbackclick attribute defined for the titlebar, then the code defined in onbackclick will be invoked, like onactionclick.

    This request add another possibility to control the page flow, using cancel button in the titlebar.

@tneil
Member
tneil commented Mar 29, 2013

Would it be possible to split these two changes into separate pull requests. It would be easier to review them separately.

@xqliu
xqliu commented Mar 29, 2013

According to my test, there's a highlight issue regarding the selected tab push, so it was reverted back,

And only one commit exists in this request.

@tneil
Member
tneil commented Mar 30, 2013

One of the main things we want to do with the back button is ensure that it is always a back button. If we allow for custom onbackbutton events, I want to make sure that we call that custom code and then also call popScreen() to move back.

This would allow you to do custom code when back is clicked, but not change the fact that the screen will go back. If we add this I would also suggest adding the same event to the actionbar

@xqliu
xqliu commented Mar 30, 2013

Sounds reasonable, I will change it accordingly and then submit the request again.

Thanks for you review :)

@tneil tneil closed this Jul 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment