Each data set has a set of built-in data references that can be useful during the dynamic region regeneration process. Like data set column names, these built-in data references must be prefixed with the name of the data set if the dynamic region is bound to more than one data set.
For example, to display the row number of the current row of the data set when the region regenerates, add the ds_RowNumber data reference to the dynamic region, as follows:
<tr spry:repeat="dsSpecials"> <td>{item}</td> <td>{description}</td> <td>{price}</td> <td>{ds_RowNumber}</td> </tr>
These options are also useful to pass a value in a JavaScript method, as follows:
<tr spry:repeat="dsSpecials" onclick="dsSpecials.setCurrentRow('{ds_RowID}')"> <td>{item}</td> <td>{description}</td> <td>{price}</td> </tr>
The following table provides a full list of built-in Spry data references.
Data reference |
Description |
---|---|
ds_RowID |
The ID of a row in the data set. This ID can be used to refer to a specific record in the data set. It does not change, even when the data is sorted. |
ds_RowNumber |
The row number of the current row of the data set. Within a loop construct, this number reflects the position of the row currently being evaluated. |
ds_RowNumberPlus1 |
The same as ds_RowNumber, except that the first row starts at index 1 instead of index 0. |
ds_RowCount |
The number of rows in the data set. If a nondestructive filter is set on the data set, this is the total number of rows after the filter is applied. |
ds_UnfilteredRowCount |
The number of rows in the data set before any nondestructive filter is applied. |
ds_CurrentRowID |
The ID of the current row of the data set. This value does not change, even when used within a looping construct. |
ds_CurrentRowNumber |
The row number of the current row of the data set. This value does not change, even when used within a looping construct. |
ds_SortColumn |
The name of the column last used for sorting. If the data in the data set was never sorted, this outputs nothing (an empty string). |
ds_SortOrder |
The current sort order of the data in the data set. This data reference outputs the words ascending, descending, or nothing (an empty string). |
ds_EvenOddRow |
Looks at the current value of ds_RowNumber and returns the string "even" or "odd". Useful for rendering alternate row colors. |