Categories | Question details Back To List | ||
Adding Rows - urgent help reqd Hi, I want to dynamically add rows to the grid using Javascript. In my grid, the column types will not be defined and only Cell types will be defined. that is for ex, the grid will be like this <column type="ro"> Column A </column> <column type="ro"> Column B</column> <column type="ro"> Column C </column> ... <row id="1"> <cell type="ed">Column A Value</cell> <cell type="co" xmlxontent="1"> .... </cell> <cell type="price">12.00</cell> How can i add rows in this case. I will be defining the grid values from the database. so i cant hard code in the add rows function. Is there by any means, i could copy the structure of the last row and have the same for the new row? Answer posted by Support on Apr 15, 2008 02:52 >>Is there by any means, i could copy the structure of the last row and have the same for the new row?
Not very simple, but possible grid.addRow(new_id,"",-1); //adding new row for (var i=0; i<grid.getColumnCount(); i++){ // set types for each column in newly added row var type=grid.cells2(0,i).cell._cellType; // here 0 - index of row , from which types will be copied grid.setCellExcellType(new_id,i,type); } |