Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Nikolai on Nov 18, 2009 05:14
open dhtmlx forum
How to set cell value in NEWLY ADDED ROW

Hi i have a table that is integrated in a form and i have made a button that adds a new row to the grid.

The question is how do i set a value in the n-th column for the newly added row.


function add_row()
{
mygrid.addRow(27000, ["","","","","","","","","","","","","","","","","",""]);
var combo = mygrid.getCombo(8);
combo.put(1,1);
combo.put(2,2);
combo.put(3,3);
combo.put(4,4);
combo.put(5,5);
combo.put(6,6);
combo.put(7,7);
combo.put(8,8);

var last_row_Ind = mygrid.getRowIndex(27000);
var previous_row_Ind = last_row_Ind - 1;

var previousDay = mygrid.cells(previous_row_Ind,1).getValue();
mygrid.cells(last_row_Ind,1).setValue(previousDay+1);
}


this code works for all cells but the one meant to be for the last row that is newly addes.

Pls help.

10x in advance.
Answer posted by dhxSupport on Nov 19, 2009 02:26
Instead of mygrid.cells(last_row_Ind,1).setValue(previousDay+1); you should use mygrid.cells2(last_row_Ind,1).setValue(previousDay+1);