Current location: Hot Scripts Forums » General Web Coding » JavaScript » problem with dynamic table


problem with dynamic table

Reply
  #1 (permalink)  
Old 07-08-04, 11:40 AM
noviceforever noviceforever is offline
Newbie Coder
 
Join Date: May 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation problem with dynamic table

I've created a dynamic table where rows can be added upon clicking 'add new row' button. the cells have textboxes and select boxes as the elements(its an interactive form embedded in a dynamic table). Its working fine except tht when i add more than a certain number of rows, the drop down select boxes are getting all mixed up and garbled. The page entirely looses its layout and the form doesnt make any sense as the elements are displaces from their original places and the page kind of freezes. Can anyone tell me why this happens and how to prevent it? (I think this problem is occuring coz i have select boxes, had the cells contained only textboxes, it wud've worked fine)
TIA.
Reply With Quote
  #2 (permalink)  
Old 07-09-04, 05:01 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation

Could you send the file or gie me the address to it and I'll take a look at it.
Reply With Quote
  #3 (permalink)  
Old 07-09-04, 11:18 AM
noviceforever noviceforever is offline
Newbie Coder
 
Join Date: May 2004
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation

Thanks a lot. I have to let u know, that this prob is somethin im facing on Win98. On win XP...i created upto 50 rows with no problem.Is it an OS specific prob?

this is part of code where i face similar problem:
JavaScript Code:
  1. function addRowToTable()
  2. {
  3. var tbl = document.getElementById('tblSample');
  4. var lastRow = tbl.rows.length;
  5. var iteration = lastRow;
  6. var row = tbl.insertRow(lastRow);
  7.  
  8. //First Cell
  9. var cellOne = row.insertCell(0);
  10. var tag = document.createElement('td');
  11. tag.setAttribute('valign','top');
  12. var e1 = document.createElement('select');
  13. e1.setAttribute('name', 'txtRow' + iteration + '1');
  14. e1.setAttribute('size','1');
  15. e1.setAttribute('style','background-color :#EFEECB');
  16. cellOne.appendChild(e1);
  17.  
  18. // Second Cell
  19. var cellTwo = row.insertCell(1);
  20. var e2 = document.createElement('select');
  21.  
  22. e2.setAttribute('name', 'txtRow' + iteration + '1');
  23. e2.setAttribute('size', '1');
  24. cellTwo.appendChild(e2);
  25.  
  26. //Third Cell
  27. var cellThree = row.insertCell(2);
  28. var e3 = document.createElement('select');
  29. e3.setAttribute('name','txtRow' + iteration + '2');
  30. e3.setAttribute('size','1');
  31. cellThree.appendChild(e3);
  32.  
  33. //Fourth Cell
  34. var cellFour = row.insertCell(3);
  35. var e4 = document.createElement('select');
  36. e4.setAttribute('name','txtRow' + iteration + '3');
  37. e4.setAttribute('size','1');
  38. cellFour.appendChild(e4);
  39.  
  40. //Fifth Cell
  41. var cellFive = row.insertCell(4);
  42. var e5 = document.createElement('select');
  43. e5.setAttribute('name','txtRow' + iteration + '4');
  44. e5.setAttribute('size','1');
  45. cellFive.appendChild(e5);
  46.  
  47. //Sixth Cell
  48. var cellSix = row.insertCell(5);
  49. var e6 = document.createElement('select');
  50. e6.setAttribute('name','txtRow' + iteration + '5');
  51. e6.setAttribute('size','1');
  52. cellSix.appendChild(e6);
  53.  
  54. //Seventh Cell
  55. var cellSeven = row.insertCell(6);
  56. var e7 = document.createElement('select');
  57. e7.setAttribute('name','txtRow' + iteration + '6');
  58. e7.setAttribute('size','1');
  59. cellSeven.appendChild(e7);
  60.  
  61. //Eighth Cell
  62. var cellEight = row.insertCell(7);
  63. var e8 = document.createElement('textarea');
  64. e8.setAttribute('name','txtRow' + iteration + '7');
  65. e8.setAttribute('rows','1');
  66. cellEight.appendChild(e8);
  67.  
  68. }

The basic HTML portion is :
HTML Code:
<input type="button" value="Add another row" onclick="addRowToTable();" />

<BR><BR>
<table border="1" id="tblSample" align="center">
<thead><tr>
<TD ALIGN='CENTER'><B>BLDG #</TD>
<TD ALIGN='CENTER'><B>FLR #</TD>
<TD ALIGN='CENTER'><B>FILE NAME</TD>
<TD ALIGN='CENTER'><B>REVISION DATE</TD>
<TD ALIGN='CENTER'><B>PROJECT #</TD>
<TD ALIGN='CENTER'><B>UPDATE ISSUED BY</TD>
<TD ALIGN='CENTER'><B>UPDATED BY</TD>
<TD ALIGN='CENTER'><B>DESCRIPTION</TD>
</thead></tr>

</table>

Last edited by TwoD; 06-22-07 at 11:18 PM. Reason: Just poking around, found this old thread when searching, and it had no highlight wrappers in it...
Reply With Quote
  #4 (permalink)  
Old 07-10-04, 10:16 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
I'm using Win XP too and there seems to be no problem.
I doubt that it's a OS related problem, mer likely it has to do with the browser.
I tested it in IE6 and there it works fine.

It could also be a problem with what is sourrounding the table, maybe there isn't enough space to squeeze in more cells without something else being moved first...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with table and form gharryh HTML/XHTML/XML 2 08-05-04 11:47 PM
problem with dynamic table noviceforever HTML/XHTML/XML 1 07-31-04 09:09 PM
Help with dynamic select in dynamic table noviceforever JavaScript 1 06-23-04 01:20 PM
Problem with a sort table js function tdubyou JavaScript 0 05-03-04 09:19 AM
table problem AlexGM14 HTML/XHTML/XML 1 01-11-04 02:18 PM


All times are GMT -5. The time now is 10:25 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.