Results 1 to 5 of 5

Thread: mistake with createChild in IE

  1. #1

    Default mistake with createChild in IE

    I'm thinking about suicide. Internet Explorer sucks, as always. I'm trying this:

    for( var i in this.colModel ) {
    Ext.fly(theadTrEl).createChild( this.colModel[i] );
    }

    Where colModel is something like that:

    [
    {tag: 'td', id: 'nombre', width: 200, html: 'Nombre'},
    {tag: 'td', id: 'dnicif', html: 'Cif'}
    ]

    And theadTrEl is a tr element from a thead section from a table. Explorer shows me an alert:

    "Unknown error in execution time"

    Does anybody know what is happening?

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,890
    Answers
    41

    Default

    You don't loop through arrays using "for( var i in this.colModel )"

    You use "for (var i = 0; i < this.colModel.length; i++)"

  3. #3

    Default this is not the problem

    I've change the loop, same problem. This is the whole Javascript code:

    TtecGrid = function(tableId, pagbarId, colModel, config){
    this.config = config || {};
    this.tableId = tableId;
    this.pagbarId = pagbarId;
    this.colModel = colModel;
    };

    TtecGrid.prototype = {
    init : function(){
    headerEl = Ext.get(this.tableId);
    theadTrEl = Ext.get(headerEl).
    createChild({tag: 'thead'}).createChild({tag: 'tr'});
    for (var i = 0; i < this.colModel.length; i++){
    Ext.get(theadTrEl).createChild( this.colModel[i] );
    }

    }
    };

    Ext.get(headerEl).createChild({tag: 'thead'}) crashes in IE. This is the html code:

    <head>
    <script type="text/javascript">
    var mygrid = new TtecGrid('myTable', 'toolbar',
    [
    {tag: 'td', id: 'nombre', width: 200, html: 'Nombre'},
    {tag: 'td', id: 'dnicif', html: 'Cif'}
    ],
    {}
    );

    Ext.onReady(function() {
    mygrid.init();
    });
    </script>
    </head>

    <body>
    <div>
    <table id="myTable" width="100%" border="0" style="font-size:12pt;">
    <tbody></tbody>
    <tfoot>
    <tr>
    <td colspan="2">
    <div id="toolbar"></div>
    </td>
    </tr>
    </tfoot>
    </table>
    </div>
    </body>
    </html>

    I don't understand, it seems Element.createChild is failing in IE

  4. #4

    Default

    I've got the same problem in f***ing IE, and found the following Workaround:

    The line throwing the runtime error is the following:
    Code:
    el.innerHTML = createHtml(o);
    (line 412 in ext-all-debug.js (ext-3.1.1)

    IE always crashes here, no matter which value is assigned to innerHTML property.

    This doesn't happen if innerHTML property is not empty.
    So I created the new Ext.Element based on an existing HTML Element:

    HTML Code:
    <div id="iesucks"></div>
    Code:
    var el=new Ext.Element(Ext.get('iesucks'));
    //do something with the el...
    
    // clear the html element to avoid changes from displaying in it...
    calframe2.update('');
    Hope this helps until IE hopefully will be forbidden by law, or this issue is fixed...

  5. #5
    Sencha User
    Join Date
    Dec 2007
    Posts
    167

    Default

    I think the issue is IE specific, usually occurs when you do something like:
    using innerHTML to insert <option> into a dropdown <select /> or insert <td> into a table row <tr/>

Posting Permissions

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