Focal Point
[SOLVED] Get A Cell in HTML Table With JAVA Code

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

April 03, 2013, 05:31 PM
KentO
[SOLVED] Get A Cell in HTML Table With JAVA Code
In my Maintain program, when I want to get a cell in a Grid with Java code, I code
 s9b_Perpetual_Billing.Grid1.GetCell(2,row);
var CellValue2=s9b_Perpetual_Billing.Grid1.CellGetText();
 

What is the coding to get a cell in a HTML table?
Thanks, Kent

This message has been edited. Last edited by: <Kathryn Henning>,


Windows2003 Server, WebFOCUS 7.7.02 Developers Studio and MRE
April 04, 2013, 11:44 AM
Alan B
The simplest approach is to use a 'Body Only' link on one of the columns. Add an event handler for ClickLink and create something like:
function OnHTMLTable1_ClickLink ( )  {
var rowNum;
var cellValue;
rowNum = document.getElementById("HTMLTable1_ClickRow").value;
cellValue = document.getElementById("HTMLTable1_TblElem").rows[rowNum-1].cells[1].innerHTML;
alert(cellValue);
}



Alan.
WF 7.705/8.007
April 04, 2013, 01:45 PM
Maintain Wizard
My technique is just slightly different. What I like about this is that it works on all browsers.
Here my form name is startform. By subtracting values from CurCol you can get values from different cells on the selected line.

var TableDiv = document.getElementById("HTMLTable1");
var TableObj;
for(i=0; i if(TableDiv.children[i].tagName == "TABLE") {
TableObj = TableDiv.children[i];
break; } }

var CurCol = Startform.HTMLTable1_ClickColumn.value;
var CurRow = Startform.HTMLTable1_ClickRow.value;
var CurVal =Startform.HTMLTable1_Value.value;
var pcode = TableObj.rows[CurRow-1].cells[CurCol-0].innerHTML;

Mark
April 10, 2013, 10:26 AM
KentO
Thanks Alan B and Mark. {SOLVED}
Kent


Windows2003 Server, WebFOCUS 7.7.02 Developers Studio and MRE