Mark,
Thank you for your samples. I was able to play around with your code and add my code until I was able to replicate my error, which led to a solution. If I manually set the row value, the data is retained. However, when I try to set the row dynamically based on the value in text box on the form, the values in the grid were not retained.
original code
var dg = document.form1.Grid2;
var currRow = document.form1.txtLastRow.value;
document.Form1.Grid2.CellSetText (1, currRow , document.Form1.MultiEditBox2.value);
document.Form1.Grid2.CellSetText (0, currRow , "Y"); //sets the indicator field value
I tried changing currRow to grid2.GetCurrentRow using both of the following samples
document.Form1.Grid2.CellSetText (1, grid2.GetCurrentRow(), document.Form1.MultiEditBox2.value);
and
var dg = document.form1.Grid2;
var currRow = grid2.GetCurrentRow();
document.Form1.Grid2.CellSetText (1, currRow , document.Form1.MultiEditBox2.value);
document.Form1.Grid2.CellSetText (0, currRow , "Y"); //sets the indicator field value
Both of the above examples worked for the first time I tried to update the comments or the fund, but the grids current row was resetting to 0 after that. Thus the next time I tried to modify either field, it was always trying to update row 0, instead of the correct row. This behavior is the reason I have a separate control on the form to track my current row to begin with. My solution is:
working code
var dg = document.form1.Grid2;
var lastRow = document.form1.txtLastRow.value;
dg.SetCurrentRow(currRow);
var currRow = dg.GetCurrentRow();
document.Form1.Grid2.CellSetText (1, currRow , document.Form1.MultiEditBox2.value);
document.Form1.Grid2.CellSetText (0, currRow , "Y"); //sets the indicator field value
WebFOCUS 7.6.8 and 7.7.03; Windows Server 2003 R2 and Windows Server 2008 R2, respectively; Development environments - Windows Server 2003 R2 and Windows 7 Professional, respectively;
excel, html, pdf