TabSheetMeasures.iterateColumnWidth

Syntax

iterateColumnWidth(action: function, context: Object, reverse: 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.

reverse. 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 iterateColumnWidth 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 measures
var measures = tabSheet.getMeasures();
// Declare secondary variables
var i = 0;
var oldWidht = 0;
var oldHeigth = 0;
// Set coefficient of new width and height of table columns and rows
var k = 1.3;
// Change width value of each table column
measures.iterateColumnWidth(function (width) {
    if (i == 0) {
        oldWidth = width;
    } else {
        var newWidth = (width - oldWidth);
        oldWidth += newWidth;
        tabSheet.setColumnWidth((newWidth * k), (i - 1));
    }
    i++;
});
i = 0; // Reset counter
// Change height value of each table row
measures.iterateRowHeight(function (height) {
    if (i == 0) {
        oldHeight = height;
    } else {
        var newHeight = (height - oldHeight);
        oldHeight += newHeight;
        tabSheet.setRowHeight((newHeight * k), (i - 1));
    }
    i++;
});
// Add the + character to each cell value
measures.eachVisibleColIndex(function (col) {
    measures.eachVisibleRowIndex(function (row) {
        var value = tabSheet.getModel().getCell(tabSheet.coord(row, col)).CellData.FormattedText;
        tabSheet.setCellValue("+ " + value, row, col);
    });
});

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:

Seebsp;also:

TabSheetMeasures