hanfdampf
Posts: 5
|
| Posted: 05/08/2009, 4:48 AM |
|
Hi all
this ought to be simple, but i just don't see how - it has to be said that my knowledge of ajax is virtually inexistent.
If you use panels, how can you prevent them from loading their content, as long as they are hidden? And how to force them loading their content, once the panel is activated?
-----
the structur of my Panels looks like below so my initial thought was to set the visible property of the update panel to false and to reload the update panel onclick of the corresponding tab-title. but how can i create this event and how could i pass a parameter to change the visible property? i seem to be on a completly wrong track...
<!-- BEGIN Panel tabbedTab -->
<!-- BEGIN Panel tabView1 -->
<!-- BEGIN Panel update1 -->CONTENT1<!-- END Panel update1 -->
<!-- END Panel tabView1 -->
<!-- BEGIN Panel tabView2 -->
<!-- BEGIN Panel update2 -->CONTENT2<!-- END Panel update2 -->
<!-- END Panel tabView2 -->
...
<!-- END Panel tabbedTab -->
--------
_________________
----------------------------
:o)(o:
using Apache, PHP mySQL on WINxp
newBee |
hanfdampf
Posts: 5
|
| Posted: 05/15/2009, 4:46 AM |
|
ok: so i had to dig into yahoo documentation a bit - it's really not all that difficult:
if (document.getElementById("p_maintabtabtab1")) {
var tab1_tab = new YAHOO.widget.Tab({
label: "<span onclick='document.searchForm.HiddenField.value=1'>#{res:tabName}</span>",
dataSrc: 'report1_tab1.php'+window.location.search,
cacheData: true,
content: '<p>display while loading</p>'});
p_maintabtabYahooTabbedView.addTab(tab1_tab, 1);
}
1. create file (not includable) for each panel content
2. set dataSrc of your tab to that file, enable cacheData if you wish
(in my case i have a search form that works for all panels, so i append the query string to the files i call: dataSrc: 'report1_tab1.php'+window.location.search)
-- the Loading Panel already works ---
3. for display during loading process set content-attribute
now if i do a search, i like to reopen the page results in the corresponding tag, therefore i do 3 things:
1. add a hidden field to the search form
2. add an onclick-event to the label, to fill the hidden field
(label:<span onclick='document.searchForm.HiddenField.value=1'>#{res:tabName}</span>)
3. set the tab you'll find in the url to active tab:
myUrlAr = parseUrl();
for (var i=0; i<myUrlAr.length; i++){
if(myUrlAr[z][0]=="tab"){
if(myUrlAr[z][1]!=""){
p_maintabtabYahooTabbedView.set('activeIndex', myUrlAr[z][1]);
}
break;
}
}
and if you need the url-parser:
function parseUrl(){
myUrlAr = new Array;
var myUrl = window.location.search.substr(1,10000);
myUrl = myUrl.split("&");
for (var z=0; z<myUrl.length; z++){
myUrlAr[z]=new Array;
myUrlAr[z][0]=myUrl[z].split("=")[0];
myUrlAr[z][1]=myUrl[z].split("=")[1];
}
return myUrlAr;
}
of course there might be better solutions - tell me if you know...
thanks for your support
_________________
----------------------------
:o)(o:
using Apache, PHP mySQL on WINxp
newBee |