Results 1 to 7 of 7

Thread: setDisabled(...) method

  1. #1
    Sencha User
    Join Date
    Dec 2011
    Posts
    11

    Default Answered: setDisabled(...) method

    why themethodis set toa string ("enabled", "disabled"), and not boolead (true/false) ?

  2. it doesn't return a string, but a function
    Code:
    return this[disabled ? 'disable': 'enable']();
    so if disabled is true, it will return 'this.disable()', else will return 'this.enable()'

    P.S.
    this['disable'] is equivalent to this.disable

  3. #2
    chramer's Avatar
    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    316
    Answers
    64

    Default

    I checked documentation.. every setDisabled() method has a boolean parameter..
    what method do you mean ? give us a link!

  4. #3
    Sencha User
    Join Date
    Dec 2011
    Posts
    11

    Default

    i mean source code method setDisabled

  5. #4
    chramer's Avatar
    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    316
    Answers
    64

    Default

    couldn't find it! everywhere is boolean! paste some code here..

  6. #5
    Sencha User
    Join Date
    Dec 2011
    Posts
    11

    Default

    /**
    * Enable or disable the component.
    * @param {Boolean} disabled True to disable.
    */
    setDisabled : function(disabled) {
    return this[disabled ? 'disable': 'enable']();
    },

  7. #6
    chramer's Avatar
    Join Date
    Feb 2011
    Location
    Chisinau, Moldova
    Posts
    316
    Answers
    64

    Default

    it doesn't return a string, but a function
    Code:
    return this[disabled ? 'disable': 'enable']();
    so if disabled is true, it will return 'this.disable()', else will return 'this.enable()'

    P.S.
    this['disable'] is equivalent to this.disable

  8. #7
    Sencha User
    Join Date
    Dec 2011
    Posts
    11

    Default

    thx. i did't see "()"

Posting Permissions

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