-
10 Nov 2011 1:56 AM #1
Unanswered: How can we track click event on a list or dataview component?
Unanswered: How can we track click event on a list or dataview component?
Hi All,
How can we track click event on a list or dataview component?. Please go through the code given below and let me know...
I am using ST2.0 with MVC pattern.Code:Ext.define('Sencha.view.ContentList', { extend: 'Ext.DataView', requires: ['Sencha.store.Contentlist'], xtype: 'contentlist', config: { width: 350, itemTpl: '<div id="{categoryid}" style="width:350px;float:left; padding:8px;border-bottom:1px solid #ccc;"><font size="2">{catogory}</font></div>', store: 'Contentlist', scrollable: 'vertical', scope:this }, listeners:{ el:{ tap: Ext.Msg.alert("Validate", "You are clicked on Item", function(){}), delegate: 'div' } } });
Thanks in advance...
-
10 Nov 2011 4:29 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
Code:listeners : { itemtap: function(dataview, index, item, e) { Ext.Msg.alert("Validate", "You are clicked on Item"); } }Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
https://github.com/mitchellsimoens
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services services@sencha.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!
When posting code, please use BBCode's CODE tags.
-
18 Nov 2011 8:51 AM #3
Shouldn't the listener be in the controller, not the view?
-
18 Nov 2011 2:04 PM #4
In your controller, do something like this in your this.control() method:
Code:this.control({ 'contentlist': { 'itemtap': this.onItemTap } });Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.


Reply With Quote