Opened 14 years ago

Closed 14 years ago

Last modified 10 years ago

#3594 closed enhancement (worksforme)

selectOnAdd

Reported by: brian Owned by: klaus.hartl
Priority: minor Milestone:
Component: ui.tabs Version: 1.6rc2
Keywords: Cc:
Blocked by: Blocking:

Description

Add the option to automatically select new tabs when they are added.

Code changes:

  • Add "selectOnAdd: false" as default for option.
  • Add "if (o.selectOnAdd) this.select(index);" as last line on "add" function

Note: Attached ui.tabs.js includes fix for ticket #3593 so "add" functionality works correctly.

Attachments (1)

selectOnAdd.zip (26.5 KB) - added by brian 14 years ago.

Download all attachments as: .zip

Change History (5)

Changed 14 years ago by brian

Attachment: selectOnAdd.zip added

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

Perhaps allowing negative numbers for the index (to start from the right instead of the left) would prevent the need for this option.

$(el).tabs('add', '#foo', 'new label').tabs('select', -1);

This could probably be limited to only allowing -1 for the last tab if that would be easier.

comment:2 Changed 14 years ago by brian

That is one possibility. But tabs could be added to the middle of the list too. That would require some additional logic.

It'd just be nice to have the option of making it the default behavior when you initialize the tabs.

comment:3 Changed 14 years ago by klaus.hartl

Resolution: worksforme
Status: newclosed

No need for an option in the core IMHO. A simple solution is already described here: http://docs.jquery.com/UI/Tabs#...immediately_select_a_just_added_tab.3F

comment:4 Changed 10 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.