Focal Point
[Solved] Maintain js Grid CellSetText error

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9897037496

November 02, 2020, 09:37 AM
Deana
[Solved] Maintain js Grid CellSetText error
Hello,

I am trying to set the value of 2 columns of the current row in a js grid using CellSetText (col, row, value). Below is my js code.

var objDg = document.getElementById('Grid1');//returns null
var objDg2 = document.Form1.Grid1;//returns a dg obj
objDg2.CellSetText (0, 1, 'Y'); //sets the value of the 1st cell in 2nd row correctly
Code Breaks here
objDg2.CellSetText (2, 1, "test");// only gets to this point if the value of col 0 is already "Y"

I have tried:
1) replacing double quotes with single quotes
2) using document.Form1.Grid1 instead of objDg2
3) switching the lines so column 2 is set before column 0
4) using GetCurrentRow and SetCurrentRow

I use this code on other .mnt files and forms without error, I do no understand why this will not work in the .mnt/form.
I am using Maintain version 7.7.03.

Any suggestions will be appreciated.

Thank you,
Deana

This message has been edited. Last edited by: Deana,


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
November 02, 2020, 11:35 AM
Maintain Wizard
Deana
This code works for me:

Form1.Grid1.CellSetText(0,1,'Y');
Form1.Grid1.CellSetText(2,1,'test');

If this code doesn't work for you, please open a case and we can go from there.

Mark
November 03, 2020, 09:22 AM
Deana
This issue is user error. I had 2 .js files, 1 for common code used for multiple forms and one for form specific code. A function got deleted from the common code. I don't remember editing the shared .js file, but must have at some point.

Thank you Mark for your assistance.


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