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

TabbedPanel: When setActiveTab is called onActivate will always return that index #292

Open
zenith77 opened this issue May 14, 2018 · 4 comments

Comments

@zenith77
Copy link

Seb,

Just noticed this issue. Just to give the scenario; I have a page, with a tabbed panel. As the user selects tabs, I store the selected tab index. When the user reloads the page, I reset the last selected tab index in setActiveTab(index) so that the user re-opens the page on the last selected tab.

Trouble is, from that reload, once setActiveTab() is called, onActivate will always return that index as it's index. So from that point I have no idea which tab they've actually selected.

Cheers,
Col.

@zenith77
Copy link
Author

Worth noting that if you set the tab via Options, it has the same behaviour.

@sebfz1
Copy link
Owner

sebfz1 commented May 21, 2018

Hi Colin,

Is it the jQuery UI or Kendo UI TabbedPanel ? I'm trying to look into it today...

Thanks
Sebastien.

@sebfz1
Copy link
Owner

sebfz1 commented May 21, 2018

Hi Colin,

I tried to reproduce your issue but its working for me (I presumed you are using the jQuery UI TabbledPanel). When I come back in the page, the correct tab is selected, and when I click antoher one, the correct index is retrieved. Are you sure you are using #onActivate and not #onActivating?

Here is the code I used:

this.tabPanel = new TabbedPanel("tabs", this.newTabModel()) {

	private static final long serialVersionUID = 1L;
	
	@Override
	protected void onConfigure()
	{
		super.onConfigure();
		
		this.setActiveTab(SampleSession.get().tabIndex);
	}

	@Override
	public void onActivate(AjaxRequestTarget target, int index, ITab tab)
	{
		SampleSession.get().tabIndex = index;

		this.info("selected tab #" + index);
		target.add(feedback);
	}
}

Please create a quickstart so I can actually reproduce your issue! :)

Thanks & best regards,
Sebastien.

@zenith77
Copy link
Author

Definitely using onActivate - I'll knock out a quickstart and see if I can replicate it.

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

2 participants