- Dec 13, 2006
1) How do I tell the active tab to load the new source. I imagine it is something like tabView.getTab(0).set('dataSrc',elTarget); but it doesn't recognize tabView. Further I am unclear how to determinine the index of the tab during the event.
You can pass the tabView instance as the 4th arg to your Event listener. See: <http://developer.yahoo.com/yui/docs/YAHOO.util.Event.html#addListener> for more details on Event listeners.
From what I understand, these clicks will always occur in the "activeTab", so you can just do:
2) How do I tell it not to trigger on clicking on the tab labels? If I was coding the tabs in html that would be easy, but they are dynamically made so I don't have an ID for just the content divs, only the div that holds everything including the labels.
The simplest approach would be to assign the listener to the content container rather than the entire tabview.
You can avoid adding an ID to the content container by using getElementsByClassName:
YAHOO.util.Event.on(tabView.getElementsByClassName('yui-content', 'div'), 'click', clickHandler);But keep in mind the content needs to be ready in that case.
Richard, Matt's suggestion is a good one. Note that there are a few good resources for you if that approach — Event Delegation — is a new one to you: http://developer.yahoo.com/yui/examples/event/event-delegation.html http://icant.co.uk/sandbox/eventdelegation/ Regards, Eric _____________________________________________ Eric Miraglia Yahoo! Presentation Platform Engineering On Dec 4, 2006, at 10:34 AM, Matt Sweeney wrote:
Another approach would be to listen for clicks on the containing element, and if the target element meets certain critera (its an anchor, has an href, etc.), handle as needed. This can be accomplished with a single listener, and then you can avoid managing listeners on your dynamic content. Matt otrorichard wrote:
You'll have to search for them all (document.getElementsByTagName ("a")) and use YAHOO.util.Event to give them onclick listeners which stop the event, and load the url into the tab using YAHOO.util.Connect. otrorichard wrote:
Hi everyone, Two questions: The simplest, How make a hyperlink inside tabview content and the new page keeps inside the tab and no outside, like a new page? All the hyperlinks in the tabview examples point to "#". The second one. I need to put inside a tabview content a php-based search page,I can get the first page, but the paging is impossible. Note: Outside the tabview my search pages work fine. thanks in advanced. Richard
__ This message has been checked for all known viruses. Virus scanning powered by Messagelabs http://www.messagelabs.comFor more information e-mail : hostmaster@
_ This message has been checked for all known viruses. Virus scanning powered by Messagelabs http://www.messagelabs.com For more information e-mail : hostmaster@
Yahoo! Groups Links
- << Previous post in topic Next post in topic >>