-
7 Feb 2007 7:48 PM #1
Advice using View
Advice using View
Hi all,
Can anyone suggest a way to implement "mouseover" functionality on the items using the View component?
Is there no choice but to cycle through all the rendered templates and add handlers to each item, or is there some collective way of doing this?
Thanks, Will.
-
7 Feb 2007 8:20 PM #2
Could you add a simple mouseover to the view?
Code:view.on('mouseover', function(){ alert('Mouseover here. Sweet'); });
-
8 Feb 2007 3:51 AM #3
Well, that would be amazing - however, 'mouseover' is not an event that is supported by the view component.
-
8 Feb 2007 6:53 AM #4
Yep you are right. I am getting this error:
I read all through the docs to try to help you, but resorted to looping through all nodes, as you mentioned.Code:You are trying to listen for an event that does not exist: "mouseover".' when calling method:
Sorry I could not be any help.
JohnT.
-
8 Feb 2007 7:06 AM #5
The View object may not directly implement mouseover events, but you certainly attach a handler to the underlying Element object to accomplish that.
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
8 Feb 2007 7:23 AM #6
Sure. Here's what I am currently doing:
But this means that I also have to listen to the DataModel to handle the case where new items are added to the view.Code:var items = this.view.getNodes(); for (var i=0; i<items.length; i++) { var itemEl = YAHOO.ext.Element.get(items[i], true); itemEl.addClassOnOver('ydataview-over'); }
I was just wondering if there was a more efficient way of doing this. Jack seems to be onto something with the QuickTips manager in version 0.4, but I haven;t dug into that code yet.
Will.
-
8 Feb 2007 7:30 AM #7
Well, I wouldn't attempt to attach to every item - it's not efficient. I think a better way is to attach at the container level and let that handler decide whether the target is something that needs to have a mouseover action, or click or whatever.
Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
8 Feb 2007 10:21 AM #8
Well, actually if you did that, you would have to repeatedly cycle through the item list to determine whether the user's mouse coordinates intersected with an item everytime the mouse moved within the view container area.
That can't be the most efficient way!
W.
-
8 Feb 2007 1:21 PM #9
I wouldn't look at coordinates at all. If you have, say a div with 5 links, and 5 images, mouseover will fire when you go over one of those 10 items. At that point you determine if you're over a link or an image or potentially something else you don't care about, based on e.getTarget.
I am I not understanding what you're trying to do?Tim Ryan
Read BEFORE posting a question / BEFORE posting a Bug
Use Google to Search - API / Forum
API Doc (4.x | 3.x | 2.x | 1.x) / FAQ / 1.x->2.x Migration Guide / 2.x->3.x Migration Guide
-
8 Feb 2007 5:34 PM #10
Tim, remember this code chunk you helped me out with a while back:
Is this what you are suggesting to him? If so, here it is.Code:getEl("mycontainer").mon('mouseover', function(e){ e.stopPropagation(); var t = e.getTarget(); /* Did they mouseover a SPAN ? */ if(t.tagName.toLowerCase() == 'span') { /* Get the node value */ // Now do whatever you want }
Similar Threads
-
advice using css please
By franklt69 in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 21 Mar 2007, 5:46 PM -
Advice on handling default configs in Ext?
By haibijon in forum Community DiscussionReplies: 2Last Post: 16 Mar 2007, 11:43 AM -
Possible bug in Ext.View
By xsokev in forum Ext 2.x: Help & DiscussionReplies: 1Last Post: 19 Feb 2007, 8:42 PM -
Need advice (topic: loadScript)
By dodge in forum Ext 1.x: Help & DiscussionReplies: 0Last Post: 11 Jan 2007, 3:19 AM -
I am newbie in the javascript I need some advice
By franklt69 in forum Ext 1.x: Help & DiscussionReplies: 0Last Post: 28 Sep 2006, 12:07 PM


Reply With Quote