Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by k on May 13, 2008 09:56
open dhtmlx forum
regarding my question earlier

regarding my question earlier, i agree there was a typo with my onselectfunction (copy paste issue)

but my problem still persists:
tabbar.setOnSelectHandler(function(idn, ido){
                      tabbar.forceLoad(idn);  
                      return true;
                  });
the above code provided previously didnot solve my problem.

If i use this, all my tabs are blocked and i cant select anything.

All i need is simple, whenever there's a mouse click on any tabs, the content of this tab should refresh itself (or simply reload the dynamic page - a jsp in my case)

Please help me out.
Answer posted by Support on May 14, 2008 07:18
Please check attached sample - it uses the same code as in your case but it works correctly in both FF and IE
If problem still occurs for you - please send any kind of sample where it can be reconstructed ( you can send it directly to support@dhtmlx.com )
Attachments (1)
Answer posted by k on May 14, 2008 07:33
hi,

i think i was not clear about my problem...i apologize for that
the problem is not with displaying dynamic contents on the tab screen

my problem is about refreshing the CURRENT ACTIVE tab
if i have 2 tabs A and B, and i am displaying information from a database in tab A which is currently active.
what i need is that if i click on tab A again while it is ACTIVE, it should reload/refresh the current tab content
(hence providing up to date information from the DB)

can you show me some code for that please?


thanks

Answer posted by Support on May 14, 2008 07:48
The forceLoad method in described scenario correctly works , but because it uses the same url each time browser just take previous page from cache instead of fetching new one
You can try approach similar to next

tabbar.setOnSelectHandler(function(idn, ido){
                      tabbar.forceLoad(idn,tabbar._hrefs[idn]+"?uid="+(new Date()).valueOf());  
                      return true;
                  });

As result on each next call function will add random element to URL, which must prevent caching
The tabbar._hrefs[idn] - existing url of selected tab
Answer posted by k on May 14, 2008 11:26
hi,

i think i was not clear about my problem...i apologize for that
the problem is not with displaying dynamic contents on the tab screen

my problem is about refreshing the CURRENT ACTIVE tab
if i have 2 tabs A and B, and i am displaying information from a database in tab A which is currently active.
what i need is that if i click on tab A again while it is ACTIVE, it should reload/refresh the current tab content
(hence providing up to date information from the DB)

can you show me some code for that please?


thanks

Answer posted by Support on May 15, 2008 05:40

Tabbar doesn't generate events when you clicking on already active tab, but you can intercept inner call, something similar to next

tabbar._setTabActive_old=tabbar._setTabActive;
tabbar._setTabActive=function(tab,mode){
      if (tab==this._lastActive){
            // here the moment, when click on active tab occured
            tabbar.forceLoad(tab.idd);
      } else return this._setTabActive_old(tab,mode);
}

( the same effect can be achieved, by injecting custom code directly in _setTabActive method in dhtmlxtabbar.js )