Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha - Community Support Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,053
    Vote Rating
    17
    mschwartz will become famous soon enough mschwartz will become famous soon enough

      0  

    Default [CLOSED][3.0] Ext.select is broken

    [CLOSED][3.0] Ext.select is broken


    Code:
        var buttons = Ext.select('a.buttonson', true);
        for (var i = 0; i < buttons.elements.length; i++) {
            var button = buttons.elements[i];
            button.blur();
            button.replaceClass('buttonson', 'buttons');
        }
    Error: button.replaceClass is not a function

    I examine buttons in firefox and it's now a CompositeElement:
    buttons[] :
    --- el
    ------ isFlyweight: true
    ------ replaceClass: function() <--- ok, so it's moved, right?
    --- elements[] :
    ------ clientLeft: 1 <--- it's a DOM node, not an Ext.Element anymore

    So I read the docs on CompositeElements and I modify my code thus:
    Code:
        var buttons = Ext.select('a.buttonson', true);
        // new 3.0 code
        buttons.el.replaceClass('buttonson', 'buttons');
        // old 2.2 code
        //for (var i = 0; i < buttons.elements.length; i++) {
        //    var button = buttons.elements[i];
        //    button.blur();
        //    button.replaceClass('buttonson', 'buttons');
        //}
    This throws an error, too:
    line 3527 ext-all-debug.js
    Code:
    removeClass: function(className) {
      var me = this;
      if (me.dom.className) {
    
    Examine 'me' and dom is 'undefined', isFlyweight=true

    So what is the bug I'm reporting?

    This line, the 'true' argument is being ignored or not behaving like 2.2 or the 3.0 docs say it should:

    var buttons = Ext.select('a.buttonson', true);

  2. #2
    Sencha - Community Support Team mschwartz's Avatar
    Join Date
    Nov 2008
    Location
    San Diego, Peoples' Republic of California
    Posts
    2,053
    Vote Rating
    17
    mschwartz will become famous soon enough mschwartz will become famous soon enough

      0  

    Default


    buttons.replaceClass() works, btw.

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,647
    Vote Rating
    583
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    elements is an private property, it retrns a series of DOM elements.

    You should use:

    Code:
    Ext.select('div.foo').each(function(el){
        el.blur();
        el.replaceClass('foo', 'bar');
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

Thread Participants: 1