1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    45
    Answers
    4
    Vote Rating
    0
    smerny is on a distinguished road

      0  

    Default 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?

  2. 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();
                                    }
                            }
                        }
                    }

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,074
    Answers
    3500
    Vote Rating
    854
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    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
    ________________
    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 in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Sep 2011
    Posts
    45
    Answers
    4
    Vote Rating
    0
    smerny is on a distinguished road

      0  

    Default


    i have a function on 'change' listener that does get fired when the button is disabled

  5. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    45
    Answers
    4
    Vote Rating
    0
    smerny is on a distinguished road

      0  

    Default


    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)

  6. #5
    Sencha User
    Join Date
    Sep 2011
    Posts
    45
    Answers
    4
    Vote Rating
    0
    smerny is on a distinguished road

      0  

    Default


    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();
                                    }
                            }
                        }
                    }

Thread Participants: 1

Tags for this Thread