wicket-jquery-ui icon indicating copy to clipboard operation
wicket-jquery-ui copied to clipboard

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

Open zenith77 opened this issue 6 years ago • 4 comments

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 avatar May 14 '18 01:05 zenith77

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

zenith77 avatar May 14 '18 01:05 zenith77

Hi Colin,

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

Thanks Sebastien.

sebfz1 avatar May 21 '18 10:05 sebfz1

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.

sebfz1 avatar May 21 '18 11:05 sebfz1

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

zenith77 avatar May 22 '18 01:05 zenith77