dcsimg
Is it possible to get the width of table cell(s) that have been dynamically built via JavaScript?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Douglas_Cavanaugh
Posted On:   Friday, November 21, 2003 11:32 AM

Goal: To build a horizontal floating menu that matches the first row (header row) of my dynamically built table (to include text and cell height/width - needs to match exactly). I have accomplished 90% of this task by extracting the text and building the row in my floating menu header and placing the floating menu where it needs to be. However, I'm having a problem aligning the table ( ) cells because of my dynamically built table. Scenario: I have a table that is built dynamically. Before it is displayed, I format the table row data (code that adds text/deletes rows etcÂ…), which alters the width of all the table cells (via JavaScript). We'll call this (for lack of a better phrase) "pre_floa   More>>

Goal:


To build a horizontal floating menu that matches the first row (header row) of my dynamically built table (to include text and cell height/width - needs to match exactly). I have accomplished 90% of this task by extracting the text and building the row in my floating menu header and placing the floating menu where it needs to be. However, I'm having a problem aligning the table ( ) cells because of my dynamically built table.


Scenario:


I have a table that is built dynamically. Before it is displayed, I format the table row data (code that adds text/deletes rows etcÂ…), which alters the width of all the table cells (via JavaScript). We'll call this (for lack of a better phrase) "pre_floater_table_format_code."


I then loop through the DOM ( ) in the first row of the table to get the text and width from each cell (using offsetWidth and/or clientWidth) and assign the text and cell width(s) to variables that I use to build my floating menu with. We'll call this (for lack of a better phrase) "get_cell_text_width_code."


Problem:


The problem is that once the table is built (and before it is altered by the "pre_floater_table_format_code") it seems as though my "get_cell_text_width_code" reads the un-processed table cell width(s) and sets these variables to the un-processed width values. The "pre_floater_table_format_code" runs much earlier than the "get_cell_text_width_code." So why wouldn't the "get_cell_text_width_code" read the cell width(s) after they've been adjusted by the "pre_floater_table_format_code?" Does this make sense? Anyone have any recommendations? Alternative solutions?


Regards,


Douglas

   <<Less
About | Sitemap | Contact