5.1 Accessing Table Data
There are two key properties for accessing the values in a table, table and data.
• table – A two-dimensional array containing the table data as displayed. The array includes header rows as well as data rows.
• data – A two dimensional array containing the raw table data (prior to grouping and summarization). It does not include header rows.
Two sub-properties that are especially useful when looping through the rows or columns of tables are 'length' and 'size'.
Note: A table that returns no data still displays the column header row. Therefore, table.length is 1 in the no-data case.
• table.length/table.size – The number of rows and columns (respectively) in the table, as displayed, including column header row.
• data.length/data.size – The number of rows and columns (respectively) in the original table (prior to grouping and summarization), including column header row.
As an example, consider the following table script, which iterates through all data rows (beginning with row index 1, the first data row) and columns of a table, and cumulatively sums these values.
var tot = 0;
for(var row = 1; row < table.length; row++) {
for(var col = 0; col < table.size; col++) {
tot = tot + table[row][col];
}
}
See Also
Accessing User-Modified Data in a Table, for information on how to access an editable table.
| << 5 Accessing Component Data | © 1996-2013 InetSoft Technology Corporation (v11.5) | 5.2 Accessing Data With Relative References >> |