I need to recover the url of the a UltraWebTab.tab after she changes in his/her internal navigation. How do I make that?
I get to recover the initial url of the tab and after navigating in the it paginates of the web that opens inside of the tab the address url the initial stays of when the tab was created.
the code in javascript is:
function RecoverUrlTab() { var ultraTab = igtab_getTabById("uwtConsultarProcesso"); if(ultraTab != null) { var Tabs = ultraTab.Tabs; for(i = 0; i < Tabs.length; i++) { var tab = ultraTab.Tabs[i]; var target = tab.getTargetUrl(); } } }
I thank who can help!
Hi Oamike,
I wrote for you sample which will do what you probably need. The only problem, is size on initialization maybe wrong because target url is not loaded yet. I used delay with 500ms, however, it can be not enough. You may try to enhance that initialization logic. Maybe add interval with checks if iframe is loaded, process onload within targetUrl and call adjustTab on main page, etc. Similar operations can be quite complex and not related to tab.
<script type="text/javascript">function adjustTab(id, oWebTab, oTab){ if(id) { oWebTab = igtab_getTabById(id); if(!oWebTab) return; oTab = oWebTab.getSelectedTab(); } var cp = document.getElementById(oWebTab.ID + '_cp'); var doc = oTab ? oTab.getTargetUrlDocument() : null; if(!doc || !cp) return; var body = doc.body; var width = body.offsetWidth, height = body.offsetHeight; cp.style.width = (width + 70) + 'px'; cp.style.height = (height + 70) + 'px';}function UltraWebTab1_AfterSelectedTabChange(oWebTab, oTab, oEvent){ adjustTab(null, oWebTab, oTab);}function UltraWebTab1_InitializeTabs(oWebTab){ window.setTimeout('adjustTab("' + oWebTab.ID + '")', 500);}</script> <igtab:UltraWebTab ID="UltraWebTab1" runat="server"> <ClientSideEvents AfterSelectedTabChange="UltraWebTab1_AfterSelectedTabChange" InitializeTabs="UltraWebTab1_InitializeTabs" /> <Tabs> <igtab:Tab Text="New Tab"> <ContentPane TargetUrl="Temp.aspx"> </ContentPane> </igtab:Tab> <igtab:Tab Text="New Tab"> <ContentPane TargetUrl="DialogUrl.aspx"> </ContentPane> </igtab:Tab> </Tabs> </igtab:UltraWebTab>
Viktor
Is there a way to set the WebTab to auto-resize - based on the content of the current tab, and not the size of the window on the client?
Or is this method described above 'better'?
I'd prefer for my user's browser window to have the scroll bar, and not my tab control...
I am using a master page with the UltraWebTab - and TargetUrls for each ContentPane (all TargetUrls are pages I server from ASP.NET)
Viktor, thank you for the answer, my problem was solved.
Oh I see what you were saying. Thought like we cannot access oTab.elemIframe when our site is deployed as www.
Anyways thank you so much for your input on clarifying my doubts.
Hi,
Sure you can get reference to parentNode from iframe and set its width/height/src, etc. You can not get content of iframe which points to www.
Codes looks fine with me. I can suggest to use elem.style.width/height instead of (or in addition to) elem.width/height to set size of elem.
To get reference to td which contains divs and iframes you also may trydocument.getElementById(oWebTab.ID + '_cp');though, iframe.parentNode/Element should work too.