Referencespreadsheet

<spreadsheet>

An interactive spreadsheet

<spreadsheet> is a General Operator component that renders a basic embedded spreadsheet tool.

Attributes and Properties

Attributes for <spreadsheet>

Other (10)

boolean. Default value: true. Header labels for the columns.

integer. Default value: 0. Number of left columns fixed in place when scrolling.

integer. Default value: 0. Number of top rows fixed in place when scrolling.

componentSize. Display height of the spreadsheet.

numberList. Indices of columns to hide.

numberList. Indices of rows to hide.

number. Default value: 4. Minimum number of columns displayed.

number. Default value: 4. Minimum number of rows displayed.

boolean. Default value: true. Header labels for the rows.

componentSize. Default value: {"size":100,"isAbsolute":false}. Display width of the spreadsheet.

Common to all components (9)
copy

reference. Create an independent copy of another component by reference. Enter a references a $name.

disabled

boolean. Default value: false. Whether this component is disabled and cannot be interacted with.

extend

reference. Extend another component by reference, inheriting its children and attributes. Enter a reference as $name.

fixed

boolean. Default value: false. Whether this component's value is fixed and cannot be modified.

fixLocation

boolean. Default value: false. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

hide

boolean. Default value: false. Whether to hide this component from the rendered output.

isResponse

boolean. Default value: false. Whether this component is treated as a response for the purposes of assessment.

name

text. The name used to reference this component from elsewhere in the document.

styleNumber

integer. Default value: 1. The style number used to select this component's visual styling from the available style definitions.

Properties for <spreadsheet name="s">

Other (25)
$s.cells

[ cell ]. The raw text contents of all cells.

$s.columnHeaders

boolean. Header labels for the columns.

$s.columns

[ cell ]. The cells grouped by column.

$s.disabled

boolean. Whether this component is disabled and cannot be interacted with.

$s.evaluatedCells

[ cell ]. The evaluated values of all cells.

$s.evaluatedColumns

[ cell ]. The evaluated cell values grouped by column.

$s.evaluatedRows

[ cell ]. The evaluated cell values grouped by row.

$s.fixed

boolean. Whether this component's value is fixed and cannot be modified.

$s.fixedColumnsLeft

integer. Number of left columns fixed in place when scrolling.

$s.fixedRowsTop

integer. Number of top rows fixed in place when scrolling.

$s.fixLocation

boolean. Whether this component's location is fixed (preventing it from being moved while still allowing other modifications).

$s.height

componentSize. Display height of the spreadsheet.

$s.hidden

boolean. Whether this component is hidden from the rendered output.

$s.hiddenColumns

numberList. Indices of columns to hide.

$s.hiddenRows

numberList. Indices of rows to hide.

$s.minNumColumns

number. Minimum number of columns displayed.

$s.minNumRows

number. Minimum number of rows displayed.

$s.numColumns

number. The number of columns.

$s.numRows

number. The number of rows.

$s.pointsInCells

[ point ]. Cells whose values are interpreted as points.

$s.pointsInColumns

[ point ]. Cell-derived points grouped by column.

$s.pointsInRows

[ point ]. Cell-derived points grouped by row.

$s.rowHeaders

boolean. Header labels for the rows.

$s.rows

[ cell ]. The cells grouped by row.

$s.width

componentSize. Display width of the spreadsheet.

Common to all components (4)
$s.doenetML

text. The DoenetML source code that produced this component.

$s.hide

boolean. Whether to hide this component from the rendered output.

$s.isResponse

boolean. Whether this component is treated as a response for the purposes of assessment.

$s.styleNumber

integer. The style number used to select this component's visual styling from the available style definitions.

Examples

Example: default <spreadsheet>

Without any additional attributes, the default <spreadsheet> is 44 rows by 44 columns.


Example: referencing <spreadsheet> data

Values stored within individual cells of a <spreadsheet> can be accessed using the following notation: spreadsheetName.cell## where ## is the column letter and row number of the cell. For example, $foods.cellA2 refers to the cell in the first column and second row of the <spreadsheet> component.


Example: <spreadsheet> with <cell> children

Initial data can be prefilled using nested <cell> children. The rowNum and colNum attributes can be used to locate data.

When only one or neither of these attributes is specified, data is populated in the following manner:

  • data is placed in the first row, first column
  • subsequent entries are placed in the next availabe column, in the same row
  • if only the column number is specified, data is placed in the previously used row
  • if only the row number is specified, data is placed in the previously used column

Example: build <spreadsheet> with rows

Initial data can be prefilled using nested <row> children, which in turn contain individual <cell> children.


Example: build <spreadsheet> with columns

Initial data can be prefilled using nested <column> children, which in turn contain individual <cell> children.


Example: using spreadsheets for computations

Spreadsheet computation formulas can be entered directly into an individual <cell> component. References for data within spreadsheets follow standard spreadsheet naming conventions, but no $ is required. Formulas can be prefilled, or entered manually by the user by clicking on the cell. Try directly entering a formula into cell B3 that references one or more of the other cells.

Attribute Examples

Attribute Example: minNumRows, minNumColumns

The default size <spreadsheet/> of 4 rows by 4 columns has been modified with the minNumRows and the minNumColumns attributes.


Attribute Example: width, height

The default size <spreadsheet> component (100% of available screen width) is shown above one with a specified width of 50% of available width.


Attribute Example: rowHeaders, columnHeaders

In this example, the rowHeaders and columnHeaders are suppressed by setting these attributes to false.


Attribute Example: hiddenRows, hiddenColumns

Individual rows and columns may be hidden using the hiddenRows and hiddenColumns attributes.


Attribute Example: fixedRowsTop, fixedColumnsLeft

Individual rows and columns may be fixed in place during scrolling using the fixedRowsTop and fixedColumnsLeft attributes. Each of these accepts an integer value for the number of rows or columns to fix in place.

Since Doenet will allow for as much height as required for the spreadsheet to display its rows, this effect is easier to observe with the columns than the rows.