Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help with the 3 Hardest Javascript problems in the world

 
YuenLian Wu
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all JS experts,

I am so weak in Javascript, and I wish I can learn something from you guys from the stupid questions I asked.

Q1. I use a cooL javascript function "insertRow" to insert a new row at the end in my table. However, my table is not consistent, which means each row can be dynamic, some of the fields in the first row can be disappeared or became another type of elements. So, when I inserted a new row to the table, it follows the previous row style(number of fields, types) to insert a new row to my table, which betrayed me. I wish each new row should be insert in a way that the first row looks like, no matter how one of the row behaves. Is there any tricky way to do so ? I am freaking out !!!

Q2. I have another table has add and delete button to add or delete the rows dynamically. Normally, one of the combo box event will trigger another combo box to it. However, when multiple rows exerted, the combo box in the other rows will always trigger the combo box in the first row, not it's own row. I beleive it's my bug, however, I don't know how to fix it. My function is provided in the following:





Thanks for helping me

Transistor
 
Joel Jorgensen
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by YuenLian Wu:

Q1. I use a cooL javascript function "insertRow" to insert a new row at the end in my table. However, my table is not consistent, which means each row can be dynamic, some of the fields in the first row can be disappeared or became another type of elements. So, when I inserted a new row to the table, it follows the previous row style(number of fields, types) to insert a new row to my table, which betrayed me. I wish each new row should be insert in a way that the first row looks like, no matter how one of the row behaves. Is there any tricky way to do so ? I am freaking out !!!


Hi YuenLian,

From what I can tell about the insertRow table method, it by itself does not add any cells to the table. If you want your added row to look just like the first row of the table, I highly recommend that you clone the first row of your table and append it to the table. Regardless of what the other rows are, the new row will then be a copy of the first row in the table. Have a go at it, and then let me know if you'd like me to be more specific.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic