1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Vote Rating
    1
    Answers
    2
    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,384
    Vote Rating
    14
    Answers
    148
    AndreaCammarata will become famous soon enough AndreaCammarata will become famous soon enough

      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


  4. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Vote Rating
    1
    Answers
    2
    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,384
    Vote Rating
    14
    Answers
    148
    AndreaCammarata will become famous soon enough AndreaCammarata will become famous soon enough

      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


Tags for this Thread