Opened 10 years ago

Closed 9 years ago

Last modified 5 years ago

#2393 closed enhancement (fixed)

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:
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 10 years ago.

Download all attachments as: .zip

Change History (15)

Changed 10 years ago by scottweaver

Attachment: ui.tabs_cookie_name.patch added

comment:1 Changed 10 years ago by paul

Owner: changed from paul to klaus

comment:2 Changed 10 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 10 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 10 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 10 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 9 years ago by (none)

Milestone: 1.2.4

Milestone 1.2.4 deleted

comment:7 Changed 9 years ago by paul

Component: ui.coreui.tabs
Version: 1.2.31.5b4

comment:8 Changed 9 years ago by klaus.hartl

Owner: changed from klaus to klaus.hartl
Status: reopenedassigned
Version: 1.5b41.5

comment:9 Changed 9 years ago by Cloudream

Milestone: TDB

comment:10 Changed 9 years ago by klaus.hartl

Priority: minormajor
Version: 1.5

comment:11 Changed 9 years ago by klaus.hartl

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

comment:12 Changed 9 years ago by klaus.hartl

Summary: Add ability to define cookie name for UI/TabsAdd 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 9 years ago by klaus.hartl

Resolution: fixed
Status: assignedclosed

comment:14 Changed 5 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.