Results 1 to 2 of 2

Thread: DomHelper

  1. #1
    Ext JS Premium Member christocracy's Avatar
    Join Date
    Oct 2006
    Location
    Montreal
    Posts
    381

    Default DomHelper

    using DomHelper to create a table.

    do I have to create the tbody and append tr nodes to that?

    Code:
    var rs = getEl('recordset');
    var table = dh.append(rs, {tag: 'table', cls: 'foo'});
    var tbody = dh.append(table, {tag: 'tbody'});
    does DomHelper::append() append the node immediately to the doc? isn't that inefficient? when creating DOMNodes, are we not supposed to first create a container element, append the children to it, then append the container to the doc, since the teh document object must recalculate everything when a node is appended to it?

    eg:
    Code:
            var container = getEl('container');
            var ul = document.createElement('ul');
            for (var i=0; i < 10; i++) {
                  var li = document.createElement('li');
                  li.appendChild(document.createTextNode(i));
                  ul.appendChild(li);
            }
    
            // finish by appending newly create ul to container
            container.appendChild(ul);

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    6,956

    Default

    For the table problem:

    http://www.jackslocum.com/forum/viewtopic.php?t=267

    Yes it adds the nodes immediately that way.

    If you are building something big and don't want to append it all at once you can create a node to use as a buffer with dom and then append to it. Personally I wouldn't worry about it. If you looked at the benchmark, it created 3000 elements in about 300 milliseconds appending them all at once. If you change it to not all at once you will see the difference in not that much, approx 50 milliseconds for 3000 elements.

Similar Threads

  1. DOMHelper in IE?
    By kjordan in forum Ext 1.x: Bugs
    Replies: 2
    Last Post: 29 Jan 2007, 7:40 AM
  2. DomHelper
    By INeedADip in forum Ext 1.x: Bugs
    Replies: 6
    Last Post: 2 Jan 2007, 6:08 AM
  3. DomHelper id
    By zquirm in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 29 Nov 2006, 3:14 PM
  4. DomHelper help Please
    By hunkybill in forum Ext 1.x: Help & Discussion
    Replies: 8
    Last Post: 17 Nov 2006, 8:30 PM
  5. DomHelper
    By INeedADip in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 18 Oct 2006, 2:25 AM

Posting Permissions

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