Adding Column Spans
Jump to navigation
Jump to search
Adds Spans (i.e., sub-headings) to the column of a table. Note that this does not change the underlying question (whereas if modifying a table by selecting headings, right-clicking and selecting Create Span the change would be made wherever the question in the rows is used).
// Span the Coke brands.
table.spanColumns([table.columnIndex('Coca Cola'),
table.columnIndex('Diet Coke'),
table.columnIndex('Coke Zero')],
'Coke Brands');
// Span the Pepsi brands.
table.spanColumns([table.columnIndex('Pepsi Light'),
table.columnIndex('Pepsi Max'),
table.columnIndex('Pepsi')],
'Pepsi Brands');
See also
- Adding Row Spans.
- Table JavaScript and Plot JavaScript for an explanation of how to run this code.
- Table JavaScript and Plot JavaScript Reference for technical information.
- Table JavaScript and Plot JavaScript Examples Library for other examples.
- JavaScript for information about the JavaScript programming language.
- QScript for tools for automating projects using JavaScript.
- JavaScript Variables for detail on how to create new variables in the Variables and Questions tab using JavaScript.