• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Instantiation vs configuration

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Instantiation vs configuration

    I know how to do this in my other life (RPG), however I've searched the forumns and books and can't seem to find the answer.

    I know how to "hardcode" an object configuration, IE, disabled : true.

    I'd like to know how to be able to change the disabled configuration option on the fly based on some logic, etc.

    Thanks...

  • #2
    If I am completely understanding you correctly just take a look at the methods in the API doc.

    So say for a button you can use the disable/enable to change it on the fly based on some logic.

    Code:
    .disable();  //disable it
    .enable(); //enable it

    Comment


    • #3
      Thanks for the reply.

      I'll look into your suggestion.

      I was wondering if there was something like this:

      state = 'true',
      disabled : state,

      Thanks...

      Comment


      • #4
        It sounds like you want to make your "disabled" configuration property dynamic. The code that you just posted should work...although 'true' should not be surrounded by any quotes.

        Code:
        if (xxx === yyy){
           initialStatus = true;
        } else {
           initialStatus = false;
        }
        
        var myComponent = new Ext.Component({
            disabled = initialStatus
        });

        Comment


        • #5
          Originally posted by sean.lanktree View Post
          It sounds like you want to make your "disabled" configuration property dynamic. The code that you just posted should work...although 'true' should not be surrounded by any quotes.

          Code:
          if (xxx === yyy){
             initialStatus = true;
          } else {
             initialStatus = false;
          }
          
          var myComponent = new Ext.Component({
              disabled = initialStatus
          });
          Thanks....

          Comment

          Working...
          X