Loading ...
Sorry, an error occurred while loading the content.

inserting rows in table dynamically

Expand Messages
  • rajtf
    Hi, This is not a direct YUI question but a javascript question. I need to insert rows dynamically in a table. I know I can do that with following code. var
    Message 1 of 1 , Sep 4, 2007
    • 0 Attachment
      Hi,

      This is not a direct YUI question but a javascript question.

      I need to insert rows dynamically in a table. I know I can do that with
      following code.

      var tbl = document.getElementById('tblSample');
      var lastRow = tbl.rows.length;

      var row = tbl.insertRow(lastRow);

      // left cell
      var cellLeft = row.insertCell(0);
      textNode = document.createTextNode("2828233665" + rownum++);
      cellLeft.appendChild(textNode);

      But what I want is not create cells and add it, but to add the whole
      row with content something like this.

      var row = tbl.insertRow(lastRow);
      row.setContent("<td>"1"</td><td>"2"</td>")

      In other words I get the whole row text and I want to insert that as
      row, insted of column by column. Couldn't find a way to do that.

      Any thoughts ???

      _Pete
    Your message has been successfully submitted and would be delivered to recipients shortly.