PDA

View Full Version : reload tab panel with new url on tab click



dlbjr
27 Nov 2007, 10:48 AM
How do I make a tap panel reload or load from a new url when tab is clicked?

Thanks!

items:[{
id:"tab1_1",
title: 'General',
autoLoad: {url: 'data/Project_general.asp', params: 'id=' + strProjectID}
},{
id:"tab1_2",
title: 'Action Items',
html: "2"
}]

hendricd
27 Nov 2007, 10:52 AM
Check the API docs.

Panels have 'activate' event.
tabPanels have 'tabchange' event.

dlbjr
28 Nov 2007, 10:10 AM
Here is what I have. Does not work! Any ideas would help expedite this learning curve.
Fires fine when selecting a tab. Fails on pnl.body.getUpdater()
Error: 'body' is null or not an object.


//Tap click function
Ext.get('TP1').on('activate', function(pnl) {
var updater = pnl.body.getUpdater();
updater.setRenderer(pnl.renderer);
updater.update({
url: 'data/Project_general.asp',
text: 'Loading...',
params: 'id=' + strProjectID
})
});

hendricd
28 Nov 2007, 10:14 AM
I updated FAQ (http://extjs.com/learn/Ext_FAQ#How_do_I_refresh_a_tabPanel-item_or_panel_contents_each_time_it.27s_clicked_or_becomes_active_again.3F) on tab updates. Have a look there.

dlbjr
28 Nov 2007, 10:30 AM
You the man! - Thanks!

By the way, this is some awesome stuff.

dlbjr
28 Nov 2007, 2:38 PM
Works, but only uses the url string on recalls not the attached parm list. I had to append a querystring to the end of the url string for it to work correctly. Can this work with the parm list?

Thanks,

hendricd
28 Nov 2007, 3:06 PM
have you tried:



...
params: {id :strProjectID}



What appears in your url when the request is made when updater.method='GET'

Are the params in the POST body for a 'POST' ?

dlbjr
28 Nov 2007, 4:06 PM
Yes, I did have params: {id :strProjectID}

I removed it and appended it to the url string for it to work. GET or POST would not work on a refresh using params: {id :strProjectID}, but it worked on the initial call.

Stumped.