TabSheetMeasures.iterateLeftOffset

Syntax

iterateLeftOffset(action: function, context: Object, isVirtual: Boolean, reverseCalc: Boolean);

Parameters

action. Function invoked on each iteration through values of table columns width.

context. Context from which the method is called. This is an optional parameter, by default it equals to the current context of this.

isVirtual. Parameter indicating if virtual or real coordinates are used. If the parameter is set to True virtual coordinates are used, otherwise real coordinates are used. This is an optional parameter, by default it is set to False.

reverseCalc. Parameter indicating direction of iteration through values of table columns width. If the parameter is set to True, iteration starts with value of the last column width, and vice versa if the parameter is False. This is an optional parameter, by default it is set to False.

Description

The iterateLeftOffset method iterates through values of table columns width..

Example

To execute the example, the HTML page must contain the TabSheet component named tabSheet (see Example of Creating the TabSheet Component). Change columns width and rows height in the table, add the plus sign + to value of each cell:

// Get table dimensions
var measures = tabSheet.getMeasures();
// Declare additional variables
var i = 0;
var oldLeftOffset = 0;
var oldTopOffset = 0;
// Set coefficient of new width and height for table columns and rows
var k = 1.3;
// Change width value for each table column
measures.iterateLeftOffset(function (leftOffset) {
    if (i == 0) {
        oldLeftOffset = leftOffset;
    } else {
        var newLeftOffset = (leftOffset - oldLeftOffset);
        oldLeftOffset += newLeftOffset;
        tabSheet.setColumnWidth((newLeftOffset * k), (i - 1));
    }
    i++
});
i = 0; // Reset counter
// Change height value for each table row
measures.iterateTopOffset(function (topOffset) {
    if (i == 0) {
        oldTopOffset = topOffset;
    } else {
        var newTopOffset = (topOffset - oldTopOffset);
        oldTopOffset += newTopOffset;
        tabSheet.setRowHeight((newTopOffset * k), (i - 1));
    }
    i++
});
// Add the + character to each cell value
measures.eachVisibleCoord(function (coord) {
    var value = tabSheet.getModel().getCell(coord).CellData.FormattedText;
    tabSheet.setCellValue("+ " + value, coord.rowIndex, coord.colIndex)
});

After executing the example width of table columns and height of table rows are increased by 1.3, and the plus sign + is added to value of each cell:

See also:

TabSheetMeasures