You are here: Foswiki>Tasks Web>Item10918 (31 Jan 2018, MichaelDaum)Edit Attach

Item10918: Improve javascript api to address individual tabs.

pencil
Priority: Enhancement
Current State: Closed
Released In: 2.1.3
Target Release: patch
Applies To: Extension
Component: JQueryPlugin
Branches: Release02x01 master Item14380 Item14537
Reported By: ArthurClemens
Waiting For:
Last Change By: MichaelDaum
To set the label of a tab dynamically (using ajax) (after having fetched the number of Facebook comments) I need to address that tab. It would be useful if the set id can be accessed.

I also would like to link to a tab directly, for instance: url/MyTopic#Comments

-- ArthurClemens - 26 Jun 2011

Use this:

%TABPANE{select="%URLPARAM{"tab"}%"}%
%TAB{"First tab" id="tab1"}%
...
%ENDTAB%
%TAB{"Second tab" id="tab2"}%
...
%ENDTAB%
...
%ENDTABPANE%

... and then http:...?tab=tab1 to select the named tab.

-- MichaelDaum - 27 Jun 2011

That doesn't solve the problem how to address the tab with javascript. Ideally I would do:
var $commentTab = $('#comment');
but now I have to resolve to
var $commentTab = $('li:eq(2)', $(this));
which is far less flexible.

-- ArthurClemens - 27 Jun 2011

True. Using %TAB{...id="comments" we've got the id as a class name in the tab container div but not in the navigation element.

Workaround:

var $commentTab = $tabpane.find(".jqTabGroup li[data="+$(".comment").attr('id')+"]:first");

-- MichaelDaum - 27 Jun 2011

This plugin has been rewritten to make it a proper TabPane class. Interaction with a tabpane can be scripted now along these lines:

var tabPane = $(".jqTabPane").data("tabPane"); // get the tabPane instance attached to the DOM node
tabPane.switchTab(".comments"); // switch to the tab given tab
tabPane.hideTab(".comments"); // hide the comments tab
tabPane.showTab(".comments"); // show the comments tab
tabPane.getNextTab(); // get the next tab after the currently selected one
tabPane.getNextTab(".comments"); // get the next tab following the comments tab

-- Main.MichaelDaum - 22 Nov 2016

 
Topic revision: r10 - 31 Jan 2018, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy