Results 1 to 5 of 5

Thread: Ext.select( '.contact-forms' ).addCls('single') raises error

  1. #1

    Default Ext.select( '.contact-forms' ).addCls('single') raises error

    Simply attempting to find an element by class name and add another classname to it:

    Code:
    Ext.select( '.contact-forms' ).addCls('single')
    This results in TypeError: Object [object Object] has no method 'attach'
    Any idea why? I'm new to ExtJS and I thought this would be a really easy thing to do!

    Cheers,
    George

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448
    Answers
    3997

    Default

    What is Ext.select( '.contact-forms' ) returning?
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

  3. #3

    Default

    Thanks for responding.
    Ext.select( '.contact-forms' )
    returns this object:
    Ext.apply.create.Class
    el: Ext.apply.create.Class
    elements: Array[1]
    __proto__: TemplateClass

  4. #4
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448
    Answers
    3997

    Default

    Ok good! So now look at the elements array and el properties. Can you find the element you want to add the CSS class to?
    Mitchell Simoens @LikelyMitch

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

    Posts are my own, not any current, past or future employer's.

  5. #5

    Default

    So to use addClass, do I have to pick out the one item from the array of one? Something like

    Ext.select( '.contact-forms' ).elements[0].addCls('single')

Posting Permissions

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