Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support something like "onbeforeunload" when switching tabs #61

Closed
gabor-farkas opened this issue Dec 9, 2014 · 2 comments
Closed

Support something like "onbeforeunload" when switching tabs #61

gabor-farkas opened this issue Dec 9, 2014 · 2 comments
Milestone

Comments

@gabor-farkas
Copy link

So that the tab switching can be "cancellable".
(This doesn't actually fit well into the programming model)

@gabor-farkas
Copy link
Author

@zkauker
Calling functions in the presenter from the renderer doesn't fit well in the programming model unfortunately.
I'd propose a solution that can bring the necessary data into the viewmodel (presenter):

  • create a bindActiveTabIndex in TabSheet so that the active tab index is can be reflected in the viewmodel
  • create a tabClicked(ParametricEventHandler handler) method on TabSheet. Calling this method will cancel the automatic tab-switching behaviour of the tabsheet, and the handler has to explicitly switch tabs using the bound activeTabIndex property.
  • create an "automaticTabSwitch" boolean property on the model (default true), the tabClicked method will set this to false.
  • create a clickedTabIndex int property on the model.
  • in the tabLink.click method in the renderer put an if based on the automaticTabSwitch value. If it's false, we don't immediately set the activeTabIndex, but instead we set the clickedTabIndex.
  • In the tabClicked method if the clickedTabIndex changes, we fire the given listener.

This seems like a little hack, but we need a quite fast solution for now for the business need I guess.
@zkauker if this is okay for you, then @mterjeki please do it this way.

@gabor-farkas gabor-farkas added this to the 0.0.12 milestone Jan 19, 2015
@gabor-farkas
Copy link
Author

it's ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant