Results 1 to 6 of 6

Thread: check method & event

  1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    37
    Vote Rating
    1
      0  

    Default 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 User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,060
    Answers
    3976
    Vote Rating
    1389
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    37
    Vote Rating
    1
      0  

    Default

    exactly

  5. #4
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,060
    Answers
    3976
    Vote Rating
    1389
      0  

    Default

    Ok, that's how Sencha Touch 2 works.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  6. #5
    Sencha User
    Join Date
    Jul 2011
    Posts
    37
    Vote Rating
    1
      0  

    Default

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

  7. #6
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,060
    Answers
    3976
    Vote Rating
    1389
      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 @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •