-
4 Jun 2011 1:50 PM #11
Yes, I should have changed the name to (e) or (event),

-
29 Aug 2011 5:47 AM #12
Delegate issues
Delegate issues
Hi all!
I have different items on each of my itemlist in my list
I want to put two different handlers accordingly to where the user tap. Here is some code
This code works when i run each itemtaps events by itself while the other one is hidden. I can't make them work all together though otherwise they do the same thing. How can i fix that?Code:listeners: { itemtap: function(view, index, item, e) { console.log(view); var rec = view.getStore().getAt(index); HomeDetails.update(rec.data); BackHome.setTitle(rec.data.game); Home.setActiveItem('homedetails'); }, delegate: '.notNavigate', itemtap: function() { alert("Coucou"); }, delegate: '.navigate', }
Thx for your help
-
13 Sep 2011 5:16 AM #13
You can also just put the item's id in the dom and fetch it from there:
More than one way to do itCode:... tpl: '<tpl for="."><li><img userid="{id}" src="{avatar}" /><h1>{name}</h1></li></tpl>', listeners: { el: { tap: function(evt, elem){ var userId = elem.getAttribute('userid'); doSomethingFunkyWithMyUser(userId); }, delegate: 'img' } } ...
Cheers,
R
-
10 Nov 2011 12:34 AM #14
Hi tomalex0,
I was followed your method which is mentioned above. According to that, I made changes in my application, even though I'm not getting the tap event. Code from my application given below. Please go through it and let me know if it have any issues.
Thanks in advanceCode:Ext.define('Sencha.view.ContentList', { extend: 'Ext.List', requires: ['Sencha.store.Contentlist'], xtype: 'contentlist', config: { width: 350, itemTpl: '<div><font size="2">{catogory}</font></div>', store: 'Contentlist', scrollable: 'vertical', onItemDisclosure: true, scope:this }, listeners:{ itemtap:function(ContentList, index, item, e){ var rec = ContentList.store.data.get(index); var image = e.getTarget("img"); if(image){ alert("image clicked"); } } } });
-
10 Nov 2011 1:30 AM #15
Is you itemtap event not working? Also there is no img tag in your tpl.
Can you explain bit more about what you looking for?
-
10 Nov 2011 4:17 AM #16
Hi,
Sorry, I forgot to repace img tag with div. Just now I done. My aim is to get the category specified in the tpl on the click event.Code:Ext.define('Sencha.view.ContentList', { extend: 'Ext.List', requires: ['Sencha.store.Contentlist'], xtype: 'contentlist', config: { width: 350, itemTpl: '<div><font size="2">{catogory}</font></div>', store: 'Contentlist', scrollable: 'vertical', onItemDisclosure: true, scope:this }, listeners:{ itemtap:function(ContentList, index, item, e){ var rec = ContentList.store.data.get(index); var image = e.getTarget("img"); if(image){ alert("image clicked"); } } } });
Thanks in advance...
-
10 Nov 2011 4:26 AM #17
Did you tried
Probably you have catogory value in store record itself. Don't need to get value rendered in tplCode:var rec = ContentList.store.data.get(index); console.log(rec) console.log(rec.get('catogory'));
-
12 Dec 2011 12:34 PM #18
Similar Threads
-
When to use event delegation?
By dolittle in forum Ext 2.x: Help & DiscussionReplies: 0Last Post: 4 Nov 2008, 9:35 AM -
what is event delegation?
By illuminum in forum Ext 2.x: Help & DiscussionReplies: 2Last Post: 28 Jun 2008, 4:57 PM -
Click Delegation Help
By thejoker101 in forum Ext 1.x: Help & DiscussionReplies: 3Last Post: 13 Jan 2007, 11:54 PM -
YUI Question : Event Delegation
By INeedADip in forum Ext 1.x: Help & DiscussionReplies: 4Last Post: 23 Oct 2006, 2:08 PM


Reply With Quote