Liquid UI - WS Reference Library

6.4.5.3 JTableControl


The JTableControl is used to create and manipulate Offline screen table controls. It constructs a new table control using the caption, row number and position information. The syntax is as follows:

JTableControl(strCaption,iRowNum,iRow,iLeft,iBottom,iRight); 

An example of a new JTableControl is shown below:

objTableControl = new JTableControl(strCaption,iRowNum,iRow,iBottom,iRight); 

The JTableControl is associated with the following methods.

SetColumnAttributes

This method sets the attributes for the table control's columns, including title, field names, length, type, width, and state. The syntax is as follows:

JTableControl.SetColumnAttributes(strTitle,strFieldName,iLength,iType,iWidth,iState); 

An example is as follows:

objTableControl.SetColumnAttributes(strTitle,strFieldName,iLength,iType,iWidth,iState); 


SetCellData

This method sets the values for the table cells. Values set are the row, column and actual value contained in the cell. The syntax is as follows:

JTableControl.SetCellData(row,col,strValue);

An example is as follows:

objTableControl.SetCellData(1,1,"value"); 


GetCellData

This method is used to get the data values from a given cell in a table control. There are two possible syntaxes - using the row and column values or using the row and field name. These are both shown below:

JTableControl.GetCellData(iRow,iCol);
JTableControl.GetCellData(iRow,strFieldName);
JTableControl.GetCellData(iRow,iCol);
JTableControl.GetCellData(iRow,strFieldName);

Examples are as follows:

strValue = objTableControl.GetCellData(1,2); 
strValue = objTableControl.GetCellData(1,"field_name");


SelectAllRows

This method selects all rows in a given table control. It has the following parameters:

  • iFlag=1: Select all rows
  • iFlag=0: Deselect all rows


The syntax is as follows:

JTableControl.SelectAllRows(iFlag); 

An example is shown below:

objTableControl.SelectAllRows(1); 


SetRowsSelectable

This method makes a given row in a table control selectable. This method takes the following optional parameter 'iFlag'. If the parameter is omitted, iFlag is automatically set to '1'. The possible settings are:

• iFlag=1: Make row selectable.

• iFlag=0: Make row unselectable.

The syntax is as follows:

JTableControl.SetRowSelectable(iRow,iFlag); 

An example is shown below:

objTableControl.SetRowSelectable(1,1); 


GetRowNumber

This method returns the number of rows in a given table control. The syntax is as follows:

JTableControl.GetRowNumber( );

An example is below:

iRowNumber = objTableControl.GetRowNumber( );


GetColNumber

This method returns the number of columns in a given table control. The syntax is as follows:

JTableControl.GetColNumber( ); 

An example is below:

iColNumber = objTableControl.GetColNumber( ); 


GetColFieldName

This method returns the name of a particular field in a given column of a table control. The syntax is as follows:

JTableControl.GetColFieldName(iCol); 

An example is below:

strFieldName = objTableControl.GetColFieldName(3); 


IsRowSelected

This method checks to see if a particular row in a table control is selected, using the row number as an argument. The syntax is as follows:

JTableControl.IsRowSelected(iRow); 

An example is shown below:

bSelected = objTableControl.IsRowSelected(3);