Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member
    Join Date
    Feb 2009
    Posts
    13
    Vote Rating
    0
    Burke is on a distinguished road

      0  

    Default [FIXED-EXTJSIV-1793]Sandbox version can collide with ids used with other versions

    [FIXED-EXTJSIV-1793]Sandbox version can collide with ids used with other versions


    We have a substantial amount of legacy code, all using and older version of Ext. We are writing our new components using Ext4. We have run into issue with id generation via Ext.id().

    In certain cases, when you render components in Ext4 without specifying an id, the generated id can collide with an existing element on the page, and give inconsistent behavior. See the sample html at the bottom of the post for an example. In this case, when the menu is rendered, it's body attaches to a previously rendered element on the page.

    One solution seem to set the Ext4.idSeed to a large number. However, this doesn't seem like a bullet-proof solution. I'd love to see a way to provide a prefix that could be added to all generated id's, something like:

    Ext4.idPrefix = 'x4';

    Ext.id() // => 'x4-ext-gen1011';

    Or even better, when running in sandbox mode, set this idPrefix automatically.

    Thanks


    ------------------------ Example ------------------------

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <script type="text/javascript" src="ext/ext-3.3.1/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="ext/ext-3.3.1/ext-all.js"></script>
    <script type="text/javascript" src="ext/ext-4.0.0/builds/ext-all-sandbox.js"></script>
    <link type="text/css" rel="stylesheet" href="ext/ext-4.0.0/resources/css/ext-sandbox.css" />
    <script type="text/javascript">
    Ext4.onReady(function() {

    // simulate a bunch of stuff being rendered in Ext 3.3
    for (var i = 0; i < 1011; i++) {
    Ext.id();
    }
    Ext.getBody().createChild();

    // now the menu code from Ext 4.0
    var el = Ext4.get('align-to-me');
    var menu = new Ext4.menu.Menu({
    xtype : 'menu',
    plain : true,
    shadow: 'drop',
    items : [
    { text : 'Item 1', plain : true },
    { text : 'Item 2', plain : true }
    ],
    width : 200
    });

    el.on('click', function() {
    menu.show();
    menu.alignTo(el);
    });
    });
    </script>
    </head>
    <body>
    <div id="align-to-me" style="float:left;border:1px solid green;">Click here to see the menu</div>
    <div style="float: right;border:1px solid red;">Over here</div>
    </body>
    </html>

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,853
    Vote Rating
    610
    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


    Makes sense, we'll look into it.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    This has been fixed for the 4.0.2 release. We will be prepending all Ids for a sandboxed Ext instance with the unique global namespace.

  4. #4
    Ext JS Premium Member
    Join Date
    Feb 2009
    Posts
    13
    Vote Rating
    0
    Burke is on a distinguished road

      0  

    Default


    Thanks for the quick fix.

  5. #5
    Sencha User
    Join Date
    Jun 2008
    Location
    Cartago, Costa Rica
    Posts
    7
    Vote Rating
    0
    Wainer is on a distinguished road

      0  

    Default same problem

    same problem


    i have this problem with ext4.07 and ext3 version! how i can fix that?

  6. #6
    Sencha User
    Join Date
    Jun 2008
    Posts
    69
    Vote Rating
    0
    pouniok is on a distinguished road

      0  

    Default


    I'm getting this issue with Ext 4.0.7 sandbox mode and Ext 3.4.0.

    I don't know how to fix it, so for the moment, I just add a config line into each ext4 object :
    id: Ext4.id()

    Better solution would be much appreciated

Similar Threads

  1. Replies: 3
    Last Post: 6 Sep 2011, 7:26 AM
  2. Replies: 0
    Last Post: 3 Feb 2011, 10:01 AM
  3. Open Source version
    By mesken in forum Ext GWT: Discussion
    Replies: 2
    Last Post: 23 Dec 2010, 10:12 AM
  4. ExtJS/Sencha and Wordpress Collide
    By mrlynn in forum Community Discussion
    Replies: 0
    Last Post: 23 Nov 2010, 12:28 PM
  5. [OPEN-517] Overlay issue in version 0.98 & 0.99
    By fermina in forum Sencha Touch 1.x: Bugs
    Replies: 2
    Last Post: 8 Nov 2010, 5:37 PM

Thread Participants: 4