-
13 Jan 2012 1:27 PM #1
Answered: Disabled Checkbox can still be checked/unchecked when on iPad
Answered: Disabled Checkbox can still be checked/unchecked when on iPad
My sencha checkboxes are unchangeable in Chrome after disabling them, however, on the iPad they are still changeable.
Is this normal? Is there a workaround to make them actually disabled in iPad rather than just greyed out?
-
Best Answer Posted by smerny
this is what i ended up doing... bit awkward but it works... also have the functionality of clicking the label to check/uncheck
Code:listeners: { check:function(){ var obj = Ext.getCmp('[cmp id]'); if(!obj.isDisabled()){ filterObjs(obj.getId(), obj.getValue(), obj.isChecked()); } }, uncheck:function(){ var obj = Ext.getCmp('[cmp id]'); if(!obj.isDisabled()){ filterObjs(obj.getId(), obj.getValue(), obj.isChecked()); } }, click: { element: 'el', fn: function() { var obj = Ext.getCmp('[cmp id]'); if(obj.isDisabled()){ if(obj.isChecked()){ obj.uncheck(); } else { obj.check(); } } } }, labelEl:{ tap:function(){ var obj = Ext.getCmp('[cmp id]'); if(obj.isChecked()){ obj.uncheck(); } else { obj.check(); } } } }
-
13 Jan 2012 2:34 PM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,684
- Vote Rating
- 435
- Answers
- 3111
So the check event doesn't fire but yeah the checkmark does change colors. There isn't a way I found to stop it but since the value doesn't change you can simply use a CSS to not sure the check changing:
Code:.x-field.x-item-disabled .x-input-radio:checked:after, .x-field.x-item-disabled .x-input-checkbox:checked:after { border-color: #DDD; }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.
-
13 Jan 2012 2:39 PM #3
i have a function on 'change' listener that does get fired when the button is disabled
-
16 Jan 2012 7:16 AM #4
okay the check/uncheck events wont fire...however with your method, if a user checks the box while it is disabled.. it wont appear checked... but then if the checkbox is enabled again it will appear checked even though the system still thinks it is unchecked (the check event never fired because the user never checked it while it was enabled)
-
16 Jan 2012 8:21 AM #5
this is what i ended up doing... bit awkward but it works... also have the functionality of clicking the label to check/uncheck
Code:listeners: { check:function(){ var obj = Ext.getCmp('[cmp id]'); if(!obj.isDisabled()){ filterObjs(obj.getId(), obj.getValue(), obj.isChecked()); } }, uncheck:function(){ var obj = Ext.getCmp('[cmp id]'); if(!obj.isDisabled()){ filterObjs(obj.getId(), obj.getValue(), obj.isChecked()); } }, click: { element: 'el', fn: function() { var obj = Ext.getCmp('[cmp id]'); if(obj.isDisabled()){ if(obj.isChecked()){ obj.uncheck(); } else { obj.check(); } } } }, labelEl:{ tap:function(){ var obj = Ext.getCmp('[cmp id]'); if(obj.isChecked()){ obj.uncheck(); } else { obj.check(); } } } }


Reply With Quote