Bug Tracker

Opened 12 years ago

Closed 11 years ago

#2393 closed enhancement (duplicate)

[ENH] Add ability to define cookie name for UI/Tabs

Reported by: scottweaver Owned by: klaus
Priority: minor Milestone: 1.2.4
Component: ui Version: 1.2.3
Keywords: ui tabs Cc:
Blocked by: Blocking:

Description

UI/Tabs currently has support for remembering active tabs via a cookie. However, there is no way to define the cookie name so all tabs look at the same cookie (within the same domain). There is a partial solution by using the path property. Unfortunately, this doesn't work in many cases. For example if the path changes or a page contains multiple tab groups .

I have attached a patch that contains the code to look for an optional "cookieName" setting within the cookie:{} option set.

-scott

Attachments (1)

ui.tabs_cookie_name.patch (1.3 KB) - added by scottweaver 12 years ago.

Download all attachments as: .zip

Change History (7)

Changed 12 years ago by scottweaver

Attachment: ui.tabs_cookie_name.patch added

comment:1 Changed 12 years ago by paul

Owner: changed from paul to klaus

comment:2 Changed 12 years ago by klaus

Resolution: worksforme
Status: newclosed

That is not true. Each tab set uses its own unique cookie name (created via $.data).

comment:3 Changed 12 years ago by scottweaver

Resolution: worksforme
Status: closedreopened

I probably wasn't completely clear with my usecase. The problem is that if it is the same tab set on different pages. The tab stays selected.

Example: I have an account page with a tabset. If I select a tab on one account then jump to a different account, that tab that was selected on the previous account is now selected on the current one. For my application, this is behavior is undesired, i.e. the state of the tabset for each account page needs to be independent.

-scott

comment:4 Changed 12 years ago by klaus

Resolution: worksforme
Status: reopenedclosed

If I understand correctly you just must not set a global path for the cookie. That way there would be a unique cookie for each single page.

Could you provide a demo to showcase that bug? Apparently I cannot reproduce it.

comment:5 Changed 12 years ago by scottweaver

Resolution: worksforme
Status: closedreopened

The problem it is always the same page, just displaying a different account in the same tabset. So altering the scope of the cookie won't be effective.

Example:

  1. User visits www.somewebpage.com/accounts.html?id=12345, tab 1 is active by default.
  2. User selects tab 2, and the state is written to a cookie.
  3. User visits www.somewebpage.com/accounts.html?id=56789, tab 1 should be the default however this is not the case since the tabset uses the same cookie as it is the same page and tabset.

I guess what I am trying to get across is the fact that the state of the tabset, for me, needs to be at a higher level than just the page/tabset/cookie scope level. For me it needs to be at the account level (in this example) and I can only do that by controlling the cookie name. So, in this case with my code changes to UI tabs, I can define two cookies: tabs-12345 and tabs-56789 and everything would work correctly. I can then, within the code, look at account number passed in the url and decide which tab is active for that specific account.

Am I making sense?

Thanks, -scott

comment:6 Changed 11 years ago by klaus

Resolution: duplicate
Status: reopenedclosed

moved to jQuery UI bug tracker

Note: See TracTickets for help on using tickets.