Opened 11 years ago

Closed 11 years ago

Last modified 7 years ago

#3062 closed feature (wontfix)

properly work with dynamically added AJAXed tabs

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

Description

1) added "exists" method

exists: function(index) {
 if (typeof index == 'string')
  return this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );
 if(this.$tabs.length <= index || 0 > index)
  return false;
 return index;
}

2) changed "tabId" because this.$tabs.filter() can't find hrefs with "." or ":" symbols.

tabId: function(a) {
 return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_]/g, '') || this.options.idPrefix + $.data(a);
},

3) "tabTemplate" option set to: '<li class="ui-tabs-nav-item"><a href="#{href}" title="#{href}"><span>#{label}</span></a></li>' for compatibilty with the UI Themes and constantly ids generation.

4) patch for "add" method

// try to find an existing element before creating a new one
if(-1 != this.exists('#'+id))
{
 this.select('#'+id);
 return;
}

5) patch fot "select" method

select: function(index) {
 index = this.exists(index);
 if(-1 != index)
  this.$tabs.eq(index).trigger(this.options.event);
},

Change History (7)

comment:1 Changed 11 years ago by kpect

I'm sorry, there is bug in exists method. Fix:

exists: function(index) {
 if (typeof index == 'string')
  return this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );
 if(this.$tabs.length <= index || 0 > index)
  return -1;
 return index;
}

comment:2 Changed 11 years ago by paul

Milestone: 1.5.21.6b

comment:3 Changed 11 years ago by Cloudream

Milestone: 1.6b1.7
Status: newassigned

comment:4 Changed 11 years ago by Cloudream

Milestone: 1.7TDB

comment:5 Changed 11 years ago by klaus.hartl

Resolution: wontfix
Status: assignedclosed

I'm sorry, I don't even know why this is necessary. Please reopen with a test case exposing the bug or at least a description of the erroneous behavior, e.g. what this is supposed fix.

comment:6 Changed 11 years ago by klaus.hartl

"properly work with dynamically added AJAXed tabs" is not a sufficient description to me.

comment:7 Changed 7 years ago by Scott González

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.