1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    36
    Vote Rating
    0
    user14 is on a distinguished road

      0  

    Default Unanswered: Define new class, create object of that type. Just to memorize syntax

    In Java we create class:
    PHP Code:
    class MyClass

        
    String name;   // <-- instance variable

        
    MyClass(String name) {      // <-- constructor
            
    this.name=name;
         }

        
    void DisplayName(){      //  <-- any class method
              
    System.out.println(name);
        }

    And now we can create object :
    PHP Code:
    MyClass   myClassVar =  new MyClass("John"); 
    After object created , we can invoke method on it:
    PHP Code:
    myClassVar.DisplayName(); 
    PLEASE: Show me the same in ExtJS !
    I mean define class and create var ( instance of that type)

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,251
    Vote Rating
    485
    Answers
    694
    scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute scottmartin has a reputation beyond repute

      0  

  3. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    6,093
    Vote Rating
    226
    Answers
    488
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default

    Code:
    Ext.define('MyClass', {
        name: undefined
        , displayName: function () {
            alert(this.name)
        }
    });
    
    var self = Ext.create('MyClass', { name: 'John' });
    
    self.displayName();

Thread Participants: 2