Richard Searle's Blog

Thoughts about software

Controlling jquery tab plugin add

Posted by eggsearle on July 4, 2011

The jquery tab plugin provides a means to dynamically add a tab, but without any evident mechanism to determine the id of the tab. My use case required the population of that panel using Lift  AJAX, which requires the id to identify the  html element to be modified.

Only the tabTemplate accepts parameters, so that mechanism does not suffice. The template mechanism is now depreciated, which would eliminate it from consideration even if the the panelTemplate accepted parameters.

The assigned id turns out to be the fragment id iff a fragment URL is specified on the add call. Specifying a full URL causes a sequential, jquery generated id to be assigned.

Dynamically creating the tab and populating can thus be done using

JsRaw("$('#tabs').tabs( 'add', '#" + id + "', 'title' )") &
SetHtml(id, <i>Id is{id}</i>)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: