Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #13033

Re: IE very slow when showing/hiding table row

From Gregor Kofler <usenet@gregorkofler.com>
Newsgroups comp.lang.javascript
Subject Re: IE very slow when showing/hiding table row
Date 2012-03-24 10:16 +0100
Organization A noiseless patient Spider
Message-ID <jkk3do$i45$1@dont-email.me> (permalink)
References <6fdd22b1-7b67-4dbf-a12b-54450b1c5ec1@pz2g2000pbc.googlegroups.com>

Show all headers | View raw


Am 2012-03-23 20:23, Lisa Liel meinte:
> I have an app which requires multiple grouping of data.  Because
> nested TBODY tags don't work (you can use them in IE, but hiding a
> parent only hides its child rows; it doesn't hide nested TBODYs), I've
> had to use something like this:
> 
> <table>
> <tr id=header0 onclick="doShowHide('row0')"><td>Group0</td></tr>
> <tr id=row0 style="display:none"><td>
> 	<table>
> 	<tr id=header1 onclick="doShowHide('row1')"><td>Group1</td></tr>
> 	<tr id=row1 style="display:none"><td>
> 		<table>
> 			[data for group0 and group1]
> 		</table>
> 	</td></tr>
> 	</table>
> </td></tr>
> <table>
> 
> The script is pretty simple:
> 
> 
> function doShowHide(rw){
> 	var o = eval("document.all." + rw);
> 	if (o.style.display == "none"){
> 		o.style.display = "";
> 	} else {
> 		o.style.display = "none";
> 	}
> }

Ugh! You know what is said about eval()?

var o = document.getElementById(rw);

will do the same in a safer and compatible way.


> Easy peasy, right?  But I have a relatively small recordset that ends
> up with header indices from 0 to 559.  And when I click a header row,
> it takes countable seconds to either show or hide the child row (in
> IE, at least, but that's what the customer is using).  Is there some
> sort of known memory leak in doing this?  I mean, it's changing one
> style attribute on one table row, regardless of how much content it
> has (which is never more than maybe 20 rows at the most), and
> shouldn't be so sluggish, should it?

It requieres a complete repaint/reflow of the page. *That* is the costly
stuff.

> If you need to look at it, I made two static examples:
> 
> http://starways.net/temp/temp.html (smallish, only 18 indices)
> http://starways.net/temp/temp2.html (medium, 559 indices)

Error in row 5734...

Anyway, speed-wise the expand/collapse works fast enough on my IE7 in a
VM (on a pretty fast computer).

Gregor

-- 
http://vxweb.net

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

IE very slow when showing/hiding table row Lisa Liel <lisa.liel@gmail.com> - 2012-03-23 12:23 -0700
  Re: IE very slow when showing/hiding table row Robert Baer <robertbaer@localnet.com> - 2012-03-23 21:00 -0800
    Re: IE very slow when showing/hiding table row Lisa Liel <lisa.liel@gmail.com> - 2012-03-26 09:54 -0700
  Re: IE very slow when showing/hiding table row Gregor Kofler <usenet@gregorkofler.com> - 2012-03-24 10:16 +0100
    Re: IE very slow when showing/hiding table row Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-24 10:58 +0100
    Re: IE very slow when showing/hiding table row Lisa Liel <lisa.liel@gmail.com> - 2012-03-26 09:59 -0700
  Re: IE very slow when showing/hiding table row SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-24 10:29 +0100
    Re: IE very slow when showing/hiding table row SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-24 11:56 +0100
    Re: IE very slow when showing/hiding table row SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-24 12:21 +0100
      Re: IE very slow when showing/hiding table row Lisa Liel <lisa.liel@gmail.com> - 2012-03-26 10:08 -0700
      Re: IE very slow when showing/hiding table row Lisa Liel <lisa.liel@gmail.com> - 2012-03-26 11:30 -0700
        Re: IE very slow when showing/hiding table row SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-27 17:23 +0200
      Re: IE very slow when showing/hiding table row Gene Wirchenko <genew@ocis.net> - 2012-03-26 13:06 -0700
        Re: IE very slow when showing/hiding table row SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-27 15:31 +0200
          Re: IE very slow when showing/hiding table row Gene Wirchenko <genew@ocis.net> - 2012-03-27 09:22 -0700
            Re: IE very slow when showing/hiding table row Stefan Weiss <krewecherl@gmail.com> - 2012-03-27 18:58 +0200
              Re: IE very slow when showing/hiding table row Gene Wirchenko <genew@ocis.net> - 2012-03-27 13:39 -0700
              [OT] Octet, byte (was: IE very slow when showing/hiding table row) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-03-28 21:58 +0200
                Re: [OT] Octet, byte (was: IE very slow when showing/hiding table row) John G Harris <john@nospam.demon.co.uk> - 2012-03-29 14:40 +0100
            Re: IE very slow when showing/hiding table row SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-27 19:25 +0200
    Re: IE very slow when showing/hiding table row Lisa Liel <lisa.liel@gmail.com> - 2012-03-26 10:03 -0700
      Re: IE very slow when showing/hiding table row SAM <stephanemoriaux.NoAdmin@wanadoo.fr.invalid> - 2012-03-27 15:39 +0200
  Re: IE very slow when showing/hiding table row Jeff North <jnorthau@yahoo.com.au> - 2012-03-27 18:47 +1100

csiph-web