1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    7
    Vote Rating
    0
    amitdutta is on a distinguished road

      0  

    Default Unanswered: Ext.get() method basic

    Unanswered: Ext.get() method basic


    Hi

    I am using Ext.get to get an element. I am using Eclipse and Spket. In spket editor I see the get method is red in color. Also there is no autocomplete support for the variable I declared.

    var exp = Ext.get('id'),
    exp.

    is this a correct behavior? Why there is no autocomplete for exp variable ? am I using correct Ext method ? What would be the best practice?
    I think this might be more of a Spket question. any pointer would be helpful.

    Thanks,
    Amit

  2. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    if you want to get an Ext component based on its id, then you should be using Ext.getCmp('componentId'). however, using an id is discouraged. you can use componentquery to find the Ext component you want. after you get the component, you can use its methods.

  3. #3
    Sencha User
    Join Date
    Nov 2012
    Posts
    7
    Vote Rating
    0
    amitdutta is on a distinguished road

      0  

    Default


    Thanks Farish, could you please site an example for using the componentquery. I am going thru a book which sites examples all using get. Kinda strange.
    Scenario: if in a page I have
    div1, div2,div3
    and button 1,2,3
    how to get access of the Ext elements.

    Thanks
    Amit

  4. #4
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    1,074
    Answers
    111
    Vote Rating
    94
    Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light Farish is a glorious beacon of light

      0  

    Default


    I am not sure what you want to do with the Ext elements/components. it could be that Ext.get() does what you need. Take a look at the API docs and then decide whether Ext.get() is what you want or Ext.getCmp(). you can also find info on component queries there along with examples.

Thread Participants: 1