Ticket #3171 (new enhancement)

Opened 19 months ago

Last modified 2 weeks ago

have option to remove tab by href content, not just by index

Reported by: tiago.freire@… Owned by: klaus.hartl
Priority: minor Milestone: 1.8
Component: ui.tabs Version: 1.6rc6
Keywords: Cc:

Description

My system generates tabs on runtime, with UUIDs as the ID attribute to ensure uniqueness. This way the menu has an href=#<uuid>, and the div has id=#<uuid>. Tracking the index of each content is tiresome, and deletion requires re-scanning the menu and updating the indexes so that I can delete the content correctly. It would be better (for me at least) if I also could use the code:

$(#menu).tabs("remove",'#<uuid>');

and not care about the indexes (which are useful in other circumstances).

Attachments

patch_3171.patch (2.8 kB) - added by francois 11 months ago.
remove, enable and disable tab by href

Change History

Changed 19 months ago by brazilianjoe

I noticed that I can use the select function to select a tab by the href. I digged the tabs code and copied 2 lines of the tabs select function to the remove function, and the enhancement request I made came true.

I just copied those 2 lines from the tabs(select) action to tabs(remove), this way I can delete by the href as wel as the index. Should be trivial to add those 2 lines to the next release.

if (typeof index == 'string')

index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );

Changed 19 months ago by Cloudream

  • priority changed from major to minor
  • owner changed from paul to klaus.hartl
  • component changed from ui.core to ui.tabs
  • milestone set to TDB

Changed 13 months ago by brazilianjoe

Hi, klaus.hartl!

I want to give you heads-up on this bug. It's a no-brainer, and will add a good functionality to jQuery tabs.

as of jQuery 1.6rc6, function remove begins like this:

/// when generated by themeroller, the remove() function is in line 5681 ///...

remove: function(index) {

var o = this.options, $li = this.$lis.eq(index).remove(),

$panel = this.$panels.eq(index).remove();

///...

you just have to change it to:

///...

remove: function(index) {

if (typeof index == 'string')

index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );

var o = this.options, $li = this.$lis.eq(index).remove(),

$panel = this.$panels.eq(index).remove();

///...

And fix with this bug/enhancement.

This enables the possibility of removing a tab using the tab's href property without losing the ability to remove according to the tab index.

Please add this feature! I need this and can patch jQuery tabs every new version, but I bet it will be a nice feature for others too.

best regards

Changed 13 months ago by klaus.hartl

I'm considering to add that functionality, but: if so, I'd like to add that consistently to all methods where it applies.

Changed 13 months ago by klaus.hartl

  • version changed from 1.5.2 to 1.6rc6
  • milestone changed from TBD to 1.7

Changed 12 months ago by rdworth

  • milestone changed from 1.7 to 1.8

Changed 11 months ago by francois

remove, enable and disable tab by href

Changed 11 months ago by francois

With this patch I think tabs is more coherent.

Changed 5 weeks ago by brazilianjoe

Just to give the heads up, since the last post is 9 months old. Will this be implemented in 1.8? Pretty please? I haven't found any mention of it being implemented on the changelogs up to 1.8rc1.

Note: See TracTickets for help on using tickets.