-
17 Jan 2012 5:42 AM #1
Answered: How to capture label tap event on checkbox fields?
Answered: How to capture label tap event on checkbox fields?
In sencha touch v1 you could do this:
This doesn't work in Touch 2 - so there must be a new way of capturing the label tap event.PHP Code:listeners:
{
labelEl:{
tap:function () {
var obj = Ext.getCmp('recall-0-1');
if (obj.isChecked()) { obj.uncheck(); }
else { obj.check(); }
}
}
}
Any clues much appreciated?
regards
Tom
-
Best Answer Posted by mitchellsimoens
you will have to do it after the component's element has been created and then do
Code:cmp.label.on('tap', function() {}, cmp);
-
17 Jan 2012 7:01 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,714
- Vote Rating
- 438
- Answers
- 3113
you will have to do it after the component's element has been created and then do
Code:cmp.label.on('tap', function() {}, cmp);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.
-
17 Jan 2012 11:57 AM #3
You *will* however be able to do this in the 2.0 final, as it is a regression.
For now though, if you want to target the label element, you can use code similar to Mitchell's:
And as Mitchell said, it will need to be initialized first.Code:component.label.on('tap', function() { console.log('tap'); });Sencha Inc.
Robert Dougan - @rdougan
Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.
-
18 Jan 2012 6:03 AM #4
Thanks
Thanks
Cheers guys - works like a charm!


Reply With Quote