Ticket #2393 (closed enhancement: fixed)

Opened 7 years ago

Last modified 23 months ago

Add ability to define cookie name for UI Tabs

Reported by: scottweaver Owned by: klaus.hartl
Priority: major Milestone:
Component: ui.tabs Version:
Keywords: ui tabs Cc:
Blocking: Blocked by:

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

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

Change History

Changed 7 years ago by scottweaver

comment:1 Changed 7 years ago by paul

  • Owner changed from paul to klaus

comment:2 Changed 7 years ago by klaus

  • Status changed from new to closed
  • Resolution set to worksforme

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

comment:3 Changed 6 years ago by scottweaver

  • Status changed from closed to reopened
  • Resolution worksforme deleted

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 6 years ago by klaus

  • Status changed from reopened to closed
  • Resolution set to worksforme

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 6 years ago by scottweaver

  • Status changed from closed to reopened
  • Resolution worksforme deleted

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 6 years ago by anonymous

  • Milestone 1.2.4 deleted

Milestone 1.2.4 deleted

comment:7 Changed 6 years ago by paul

  • Version changed from 1.2.3 to 1.5b4
  • Component changed from ui.core to ui.tabs

comment:8 Changed 6 years ago by klaus.hartl

  • Owner changed from klaus to klaus.hartl
  • Status changed from reopened to assigned
  • Version changed from 1.5b4 to 1.5

comment:9 Changed 6 years ago by Cloudream

  • Milestone set to TDB

comment:10 Changed 6 years ago by klaus.hartl

  • Priority changed from minor to major
  • Version 1.5 deleted

comment:11 Changed 6 years ago by klaus.hartl

  • Summary changed from [ENH] Add ability to define cookie name for UI/Tabs to Add ability to define cookie name for UI/Tabs

comment:12 Changed 6 years ago by klaus.hartl

  • Summary changed from Add ability to define cookie name for UI/Tabs to Add ability to define cookie name for UI Tabs

In case of two pages that just differ in their url parameters:

/foo?bar=1 /foo?bar=2

the cookie name for a tab pane will be the same, thus it is going to be reused. This is undesireable in certain situations, thus a cookie name must be specifyable.

comment:13 Changed 6 years ago by klaus.hartl

  • Status changed from assigned to closed
  • Resolution set to fixed

comment:14 Changed 23 months ago by scott.gonzalez

  • Milestone TBD deleted

Milestone TBD deleted

Note: See TracTickets for help on using tickets.