Tab bugs/questions

Tab bugs/questions


Here's a problem I came across while looking at tabs.
I need to ensure that when a tab is opened it's unique. That is, when
an attempt is made to open a tab with the same content, an existing
tab should open up instead.
Here's what I mean:
I have a grid that lists, say data on sales from a database. When a
user clicks/double clicks a row a new tab opens containing, say, a
sales report. If a user double clicks the same row again, i need to
show him the previously opened tab. Is it possible with jQuery tabs?
/-----------------
NOTE: Having posted that to jquery-list I found a lengthy workaround
for this problem:
The tabs I open are Ajax-tabs. Each loads a hidden <div
class="id">unique_id</div>. In the onLoad callback I search for this
div and update a global hash that maps ids to tabs.
This doesn't work, however when cache is set to true (see related bug
below) because this way a tab's id isn't set until the tab is clicked
-------------------/
And here's the bug:
Let's say you add a new Ajax tab, let's call it tab-1. When you click
on it, a request is sent to the server.
Add another Ajax tab, let's call it tab-2. When you click on it, a
request is sent to the server. When you click on tab-1, the request to
the server is sent *twice*
Add a third Ajax tab, tab-3. Now clicking on
- tab-3 sends *one* request
- tab-2 sends *two* requests
- tab-3 sends *three* requests
And so on.
This is solved by setting {cache: true} when constructing tabs, but
the behaviour is weird nonetheless.