1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Answers
    2
    Vote Rating
    1
    shaleen is on a distinguished road

      0  

    Default Answered: Array

    Answered: Array


    Hi

    var xyx=Ext.DomQuery.select('div.hiddenfield');
    Ext.Array.each(xyx,function(i){
    i.addClass('item-selected');
    });

    Uncaught TypeError: Object #<HTMLDivElement> has no method 'addClass'

    Please tell me where i am wrong..


  2. That's because the "addClass" has been renamed to "addCls".
    Let's use "addCls" and everything will works fine.

  3. #2
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Answers
    148
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    Hi,
    the problem here is that the "Ext.DomQuery.select" function returns you an HTML element and not an Ext.Element, this is why you get that error message.
    For this reason, if you want to use the "addClass" method, you should get the Ext.element associated to every HTML element you've got as follow:

    Code:
    var xyx=Ext.DomQuery.select('div.hiddenfield'); 
    Ext.each(xyx,function(i){
        Ext.get(i).addClass('item-selected');
    });
    Hope this helps.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


  4. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Answers
    2
    Vote Rating
    1
    shaleen is on a distinguished road

      0  

    Default


    TypeError: Object [object Object] has no method 'addClass'
    Still error is there..

  5. #4
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Answers
    148
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    That's because the "addClass" has been renamed to "addCls".
    Let's use "addCls" and everything will works fine.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


Thread Participants: 1

Tags for this Thread