Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Re: Data layer for speed in fat-ajax applications

Expand Messages
  • Peter Michaux
    ... My situation is a complete replace of the tbody where all rows are changing. This is used in pagination or a very big dataset. Peter
    Message 1 of 8 , Jul 31 1:23 PM
    • 0 Attachment
      On Thu, Jul 31, 2008 at 11:38 AM, y_lsmith <lsmith@...> wrote:
      > --- In ydn-javascript@yahoogroups.com, "Peter Michaux"
      > <petermichaux@...> wrote:
      >>
      >> On Thu, Jul 31, 2008 at 9:21 AM, y_lsmith <lsmith@...> wrote:
      >> > --- In ydn-javascript@yahoogroups.com, "Peter Michaux"
      >> > [snip]
      >> >>
      >> >> It is a roundabout way to use innerHTML.
      >> >>
      >> >> Suppose a table in the actual pages needs to be updated. If a
      > variable
      >> >> "rows" holds the html to be used as the new rows of the table then do
      >> >> this
      >> >>
      >> >> var d = document.createElement('div')
      >> >> d.innerHTML = '<table><tbody>' + rows + '</tbody></table>';
      >> >> var tbody = d.childNodes[0].childNodes[0]
      >> >>
      >> >> This tbody element can replace the current tbody element actually in
      >> > the page.
      >> >>
      >> >> This procedure using innerHTML is much faster than using
      > createElement
      >> >> and appendChild to build up the cells and rows of a table.
      >> >>
      >> >> ----
      >> >>
      >> >> I've wrapped this type of functionality up in a library:
      >> >>
      >> >>
      >> >
      > http://dev.forkjavascript.org/trac/browser/branches/RB-0.1/public/javascripts/fork/mutate.js#L83
      >> >> http://forkjavascript.org/mutate/docs
      >> >>
      >> >> Peter
      >> >>
      >> >
      >> > This method is a good solution for moderately sized tables containing
      >> > content free of event handlers.
      >>
      >> Why do you write "moderately sized"? I specifically used this for a
      >> very large table. The larger the table the bigger the benefit.
      >
      > If you have a large table, I would think that appending a docfrag to
      > the existing tbody would render faster because the entire DOM
      > structure in the tbody isn't being recreated, only reflowed.

      My situation is a complete replace of the tbody where all rows are
      changing. This is used in pagination or a very big dataset.

      Peter
    Your message has been successfully submitted and would be delivered to recipients shortly.