Load tabbar content on ActiveTab

Hi,

I’ve got a lot of Tabs, and in each one a lot of informations to load (from XML, HTML, PHP scripts…).
The problem is that the soft works very slowly until all tabs contents are loaded.

I would like to load content just when a Tab sets active. I wrote so :

tmpTabbar.attachEvent("onXLE", function(){ tmpTabbar.attachEvent("onSelect", function(pId){ tmpTabbar.setTabActive(pId); } ); } );

But it doesn’t works, firebug tells me “too much recursion”. How could I perform this ?

Does anyone have an idea ?

Hi,

But it doesn’t works, firebug tells me “too much recursion”. How could I perform this ?

the reason for the problem is that setTabActive method also calls onSelect event. Therefore

tmpTabbar.attachEvent(“onSelect”,
function(pId){
tmpTabbar.setTabActive(pId);
}
);
is incorrect.

onSelect event is called when tab is selected. And if event doesn’t return true, the selection is canceled.

You may try to use “iframe-on-demand” loading mode. In this case iframe page is loaded only when tab is selected. The sample is

dhtmlx.com/docs/products/dhtmlxT … rames.html

Hi all,

i have a similar problem, but the iframe solution does not work for my needs.

I try to initialize a tabbar and place the content in it´s cell with using the “setContentHref()” method. It works perfect, when the content is placed the first time.
When i try to call the method a second time, i get at “too much recursion” error.

I attached a sample project where you can test it yourself; just click the “SetContent” Link once and after some seconds a second time…

I hope you have a solution for this.

br
Michael

Hi,

we have reproduced the problem in your sample. However, it doesn’t occur in the 2.6 (the latest version). Please try to use the new tabbar version.

Hi Alexandra,

thank you for your reply.

I fear this is not so easy, as we are using the pro-functions of the tabbar in our real project. I´ll have to get it done with this version (until we buy an upgrade to the current pro version … later).

br
Michael

Hi,

we try to fix the problem, but we need your dhtmlxtabbar.js. You may either create a ticket here: support.dhtmlx.com/
or send it by email to support at dhtmlx.com

Hi Alexandra,

the dhtmlxtabbar.js is the one which I uploaded in my sample. You can take it from there.

br
Michael

Hi,

you should not attach libraries from PRO edition (even old versions) on forum. You may send them by email or attach to tickets at support.dhtmlx.com/

Here is the fixed setContentHref method from the dhtmlxtabbar.js, in your demo (I’ve deleted it):

line 194

setContentHref: function(id, href) { this._hrefs[id] = href; switch (this._hrfmode) { case "iframes": this.cells(id).attachURL(href); break; case "iframe": case "iframes-on-demand": this.cells(id)._delay = ["url", href, false]; break; case "ajax": var cell = this.cells(id); var that = this; cell._delay = ["urlajax", href, true]; if (!cell.attachHTMLStringA){ cell.attachHTMLStringA = cell.attachHTMLString; cell.attachHTMLString = function(str, xml) { if (xml) str = that._getXMLContent(xml.doXPath("//content")[0]); return this.attachHTMLStringA(str) }; } break; case "ajax-html": this.cells(id)._delay = ["urlajax", href, true]; break }; if (this._tabs[id] == this._lastActive) this.cells(id).show(true) },

Hi Alexandra,

I´d like to apologize. Your code snip is the solution.

Thank you very much.

br
Michael