PDA

View Full Version : Prevent loading tab content each time tab is clicked



freakishmisko
24 Mar 2007, 2:40 PM
Hi fellas,

I have a region with tabs - 1 is Grid Panel, which contains links that opens new tabs in this region (ContentPanels) . I'm setting the content of this new tabs in a function call:



addNewTab : function (location,tab,id){
var holder = Ext.DomHelper.append(document.getElementById('container'),{tag: 'div'});

var region= layout.getRegion(location);
var panel = new Ext.ContentPanel(holder, {title: tab['title'],fitToFrame:true, closable: true,url: 'display_feed.php?noCache=' + (new Date()).valueOf()+'&ident='+tab['recid']});

layout.add('center',panel );

}


My problem is , that each time i click on different tab, and get back to previous tab, the content is reloaded. As i am doing some inline editing in those created tab, it's necessary that these don't get reloaded while switching between all the tabs..

any help will be highly appreciated

Misko

tryanDLS
25 Mar 2007, 9:31 AM
Are you calling addNewTab every time you click on a link? So that each time you're recreating the tab and reloading, rather than just displaying if it exists?

freakishmisko
25 Mar 2007, 9:40 AM
No, addNewTab is called only when tab is created.

Imagine this situation:
I have one non-closable tab (gridPanel) with DB records. When you click on the record (there's an embedded <a> tag in the grid) it calls add new tab, that opens the record in a new tab. you can have any amount of records opened, and do inline editing in them - sometimes you edit a record and need to copy something from other record, so you switch between the tabs - my problem is that when u get back to previous tab , the content is reloaded and editing mode lost with all the changes made.

thanks for ur help

m.

Animal
25 Mar 2007, 9:57 AM
Use the loadOnce config option.

freakishmisko
25 Mar 2007, 10:03 AM
Thanks a lot Animal, that solved my problem!

Much appreciated!

all the best
Misko