Connecting Tech Pros Worldwide Help | Site Map
 
 
LinkBack Thread Tools Search this Thread
  #1  
Old December 10th, 2007, 10:25 AM
Sorrow
Guest
 
Posts: n/a
Default Manipulating a table via the DOM

I'm wondering if there is anything out there that discusses the above? I
need to be able to add and remove TDs and TRs to a table all the while
maintaining the overall layout. For example, if the table currently has one
row with 3 columns and the user wants to split the 1st column horizontally,
I need to ensure that the 2nd and 3rd columns have the 'rowspan="2"'
attribute. I can add/remove TDs and TRs easy enough. But I'm just not sure
the best way to keep track of the overall layout (ie, row and column spans)
as new ones are added/removed.

I'm wondering if anyone has any advice they can offer?

thnx,
Christoph





  #2  
Old December 10th, 2007, 09:35 PM
Csaba Gabor
Guest
 
Posts: n/a
Default Re: Manipulating a table via the DOM

On Dec 10, 11:19 am, "Sorrow" <jcbo...@yahoo.comwrote:
Quote:
I'm wondering if there is anything out there that discusses the above? I
need to be able to add and remove TDs and TRs to a table all the while
maintaining the overall layout. For example, if the table currently has one
row with 3 columns and the user wants to split the 1st column horizontally,
I need to ensure that the 2nd and 3rd columns have the 'rowspan="2"'
attribute. I can add/remove TDs and TRs easy enough. But I'm just not sure
the best way to keep track of the overall layout (ie, row and column spans)
as new ones are added/removed.
>
I'm wondering if anyone has any advice they can offer?
>
thnx,
Christoph

There are two approaches that I can think of offhand - I've
implemented the fist one in the past. The problem is that it is tough
to establish a correspondence between the cells in other rows/columns
and a given cell. This comes about because the HTML specifies
relationships of local cells (rowspan, colspan), and this can have
global consequences affecting the entire table.

You could conceptually assume that there is an underlying cell level
table where every cell in your cell level table points to the cell (or
cells) in the rendered table that cover it. AND every cell in the
rendered table points to the cell(s) in the underlying cell level
table that it covers. If you can build this table, then you can
easily identify related parts (columns, rows) in your original table.
Putting the underlying cell level table together is straightforward as
I recollect, but must be methodically done. Be careful to account for
situations like the first cell in all rows having a colspan greater
than 1. When I had to do detailed table work, this worked well for
me.

The second approach is to base this determination off geometry rather
than rowspan, colspan values. By identifying the top left, bottom
right corners of two cells, it's possible to determine whether they
overlap or not. This might be enough for your particular purposes.

Csaba Gabor from Vienna
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 205,414 network members.