isColumnBelong(colIndex: Number);
colIndex. Table column index.
The isColumnBelong method determines whether the column with specified index is included into the given range.
This method returns True if the column with specified index belongs to the given range, and False if it does not belong to the range.
To execute the example, the HTML page must contain a component named tabSheet (see Example of Creating the TabSheet Component). Determine the B1:B2 range, and check if the column B, row with the index 1 and the B2 cell belong to this range:
// Determine the B1:B2 range var range = tabSheet.getRange(1, 1, 1, 2); // Determine coordinates of range's corner cells var coords = range.getCorners(); console.log("Source range: (" + coords.tlCoord.rowIndex + ", " + coords.tlCoord.colIndex + ")-(" + coords.brCoord.rowIndex + ", " + coords.brCoord.colIndex + ")"); // Check if the column is in the B range var isColumnBelong = range.isColumnBelong(1); console.log("Column B" + (isColumnBelong ? "" : " is not") + " is in the range"); // Check if the row with the 1 index is in the range var isRowBelong = range.isRowBelong(1); console.log("The row with the 1 index" + (isRowBelong ? "" : " is not") + " is in the range"); // Check if the B2 cell is in the range var isCoordBelong = range.isCoordBelong(tabSheet.coord(2, 1)); console.log("The B2 cell" + (isCoordBelong ? "" : " is not") + " is in the range");
After executing the example the browser console shows the result of checking if the column B, row with the index 1 and the B2 cell belong to the B1:B2 range:
Initial range: (1, 1)-(2, 1)
Column B belongs to the range
Row with the index 1 belongs to the range
The B2 cell belongs to the range
See also: