473,322 Members | 1,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Table appendChild/removeChild crashes IE6

Hi All,

I'm creating a table using createElement / appendChild and everything
works great.
Ussualy I have no more than 20 rows and they contain less that 5
columns.

Where my code starts to break (IE6 only, FF works great) is when I
quickly clear(removeChild) the table and insert new rows. My problem is
that I am getting a IE6 crash and the last log message shows a
different location most of the time.

Trying to use deleteRow, insertRow is no different and my understanding
is that innerHTML is readonly with TOM.

So what can I do? Any ideas?

Regards,
Sebastian

Jul 13 '06 #1
3 9844
sf****@gmail.com wrote:
Hi All,

I'm creating a table using createElement / appendChild and everything
works great.
Ussualy I have no more than 20 rows and they contain less that 5
columns.

Where my code starts to break (IE6 only, FF works great) is when I
quickly clear(removeChild) the table and insert new rows. My problem is
that I am getting a IE6 crash and the last log message shows a
different location most of the time.

Trying to use deleteRow, insertRow is no different and my understanding
is that innerHTML is readonly with TOM.

So what can I do? Any ideas?

Regards,
Sebastian

Are you taking into account the implicit TBODY element?

HTML pages served as HTML always have an implicit TBODY element.
XHTML pages served as XHTML do not.
XHTML pages served as HTML may or may not.

Step carefully :-)

Jeremy
Jul 13 '06 #2

sf****@gmail.com wrote:
Hi All,

I'm creating a table using createElement / appendChild and everything
works great.
Ussualy I have no more than 20 rows and they contain less that 5
columns.

Where my code starts to break (IE6 only, FF works great) is when I
quickly clear(removeChild) the table and insert new rows. My problem is
that I am getting a IE6 crash and the last log message shows a
different location most of the time.

Trying to use deleteRow, insertRow is no different and my understanding
is that innerHTML is readonly with TOM.

So what can I do? Any ideas?
Difficult to tell without code. In IE, when using
createElement/appendChild for table rows, you must add the rows to a
table section element (tbody, thead, tfoot). Other browsers allow you
to append created rows to the table and then add them to the tbody.

If you have a reference to an existing row, you can do something like:

var oTR = document.createElement('tr');
rowRef.parentNode.appendChild(oTR);

insertRow is normally pretty reliable since it is DOM 1, remember to
include an index value for where to put the row (IE allows you to omit
it):

var oTR = tableRef.insertRow(-1);
'-1' will insert the row as the last in the table. The tableSection
interface supports insertRow too, so you can get a reference to a table
section element and use insertRow with that:

var oTR = tBodyRef.insertRow(-1);
The index must be in the range -1 to tBodyRef.rows.length. I've
created thousands of rows using insertRow in IE and never had any
problem with it.
--
Rob

Jul 13 '06 #3
Thanks for your responses Rob & Jeremy.

As I was trying to get a cleaner version of the
code(http://webfx.eae.net/dhtml/collist/columnlist.html) that I could
post I found the bug:

....
this._eBodyCols = this._eBodyTable.tBodies[0].rows[0].cells;
....

and then when remove row would remove the first row I'll be left with a
dangling reference.

The crash was happening when accessing the non-null
this._eBodyCols.length

So indeed, the bug was not in the TOM ;) but it's a crash nonetheless..

Regards,
Sebastian

Jul 19 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: kie | last post by:
hello, i have a table that creates and deletes rows dynamically using createElement, appendChild, removeChild. when i have added the required amount of rows and input my data, i would like to...
1
by: Steve S | last post by:
I need some help modifying this code. The code was orginally setup to add/remove a single table row. I modified it to add 2 (two) rows with one column that spans both rows. That part works. I...
2
by: Joakim Braun | last post by:
I'm trying to make an "editable table". You double-click on a table cell, it becomes a text input element, you edit the value, click outside the text input and the <td> contents/text node(s) are...
2
by: Mike | last post by:
My page populates a table with a list of names and other information from a JavaScript object. I receive changes (adds, change & delete) to that list, convert it into a JavaScript object. I do...
1
by: bumpy | last post by:
I wrote this pretty slick DHTML table that lets you add/remove rows and show/hide columns on the fly. It works perfectly in IE7, but it doesn't behave in Firefox 2.0.0.4. You can see it in action...
6
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data,...
4
by: SirCodesALot | last post by:
Hi All, I am trying to dynamically replace a table in the dom, anyone have an idea on how to do this. here is some sample suedo code of what I want to do. var tableHTML = "<table...
10
by: r_ahimsa_m | last post by:
Hello, On index.html page I have a table with id="property_fields". <table id="property_fields" name="property_fields" border="0"> It contains set of rows with the following IDs: var...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.