Results 1 to 4 of 4

Thread: Array

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Answers
    2
    Vote Rating
    1
      0  

    Default 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
    Location
    Italy
    Posts
    1,395
    Answers
    148
    Vote Rating
    24
      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
    Owner at SIMACS

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

    TUX components bundle for Sencha Touch 2.x.x
    https://github.com/AndreaCammarata/TUX


  4. #3
    Sencha User
    Join Date
    Mar 2012
    Location
    Bangalore, India
    Posts
    139
    Answers
    2
    Vote Rating
    1
      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
    Location
    Italy
    Posts
    1,395
    Answers
    148
    Vote Rating
    24
      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
    Owner at SIMACS

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

    TUX components bundle for Sencha Touch 2.x.x
    https://github.com/AndreaCammarata/TUX


Tags for this Thread

Posting Permissions

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