1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    37
    Vote Rating
    1
    vnurin is on a distinguished road

      0  

    Default Answered: check method & event

    Answered: check method & event


    check/uncheck method triggers appropriate events in ST1.1, but it is not like that in ST2.0. How to have that in ST2.0 code?

  2. It's not needed. To change the check status, it simple toggles the dom.checked field:

    Code:
        onMaskTap: function(component, e) {
            var me = this,
                dom = component.input.dom;
    
            if (me.getDisabled()) {
                return false;
            }
    
            //we must manually update the input dom with the new checked value
            dom.checked = !dom.checked;
    
            //continue as normal, like a normal tap
            // this.onTap(component, e);
    
            //calling getchecked will sync the new checked value
            if (me.getChecked()) {
                me.fireEvent('check', me, e);
            }
            else {
                me.fireEvent('uncheck', me, e);
            }
    
            //return false so the mask does not disappear
            return false;
        },

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    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


    What do you mean? When you check a checkbox or radio field, the check event is fired. When you uncheck it, the uncheck event is fired.
    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
    Jul 2011
    Posts
    37
    Vote Rating
    1
    vnurin is on a distinguished road

      0  

    Default


    exactly

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    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


    Ok, that's how Sencha Touch 2 works.
    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.

  6. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    37
    Vote Rating
    1
    vnurin is on a distinguished road

      0  

    Default


    sorry, mean not that but calling check()/uncheck() methods

  7. #6
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,327
    Answers
    3540
    Vote Rating
    850
    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


    It's not needed. To change the check status, it simple toggles the dom.checked field:

    Code:
        onMaskTap: function(component, e) {
            var me = this,
                dom = component.input.dom;
    
            if (me.getDisabled()) {
                return false;
            }
    
            //we must manually update the input dom with the new checked value
            dom.checked = !dom.checked;
    
            //continue as normal, like a normal tap
            // this.onTap(component, e);
    
            //calling getchecked will sync the new checked value
            if (me.getChecked()) {
                me.fireEvent('check', me, e);
            }
            else {
                me.fireEvent('uncheck', me, e);
            }
    
            //return false so the mask does not disappear
            return false;
        },
    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.

Thread Participants: 1