Object

DataDescriptor

The object for providing the data type, data formatting, and label for a field in a table.

Properties

dataType
string
(Required)

The data type.

Valid values:

  • string. Short text values, shorter than a typical sentence. Column widths are calculated differently for string and text data. string supports data values that are provided as strings or as FormattedText.

  • text. Long text values, as long as a typical sentence or longer. Column widths are calculated differently for string and text data. text supports data values that are provided as strings or as FormattedText.

  • image. Image URLs, starting with bundle:// for an image provided in the same location as article.json, or starting with http:// or https:// for remote images. The images are displayed in the table. See Preparing Image, Video, Audio, Music, and ARKit Assets. To control image size, use a ImageDataFormat object as the value of the format property.

  • number. Numerical values where the more specific data type is not known.

  • integer. Integer values.

  • float. Floating-point values. To format the value, use a FloatDataFormat in the format property.

key
string
(Required)

The name of this data descriptor. In a data record, you use this name as the key in a key-value pair, where the value is the data itself. This key must be unique across data descriptors in this data record store. See RecordStore.

label
*
(Required)

The text to appear in the table header for this data category. This text can be provided as a string or a FormattedText object.

format

The object that sets some additional formatting preferences if you are using the float or image data type. For example, use a FloatDataFormat object in this property to control rounding, or use an ImageDataFormat to control image size.

identifier
string

A unique identifier for this data descriptor. If used, identifiers must be unique across descriptors in this data record store. An identifier is required if you want to sort your table by any order other than the order in which the records are provided.

Discussion

A DataDescriptor object defines the data in a table by including basic information such as data type, data format, and a name for this set of data that identifies the kind of information it is. For example, the name could be "product number" or "release year". An array of all the data descriptors for a table is located in the table’s RecordStore.

Example

{ "components": [ { "role": "datatable", "showDescriptorLabels": true, "sortBy": [ { "descriptor": "id-name", "direction": "descending" } ], "data": { "descriptors": [ { "identifier": "id-image", "key": "image", "label": { "type": "formatted_text", "text": "Image" }, "format": { "type": "image", "maximumWidth": "50pt" }, "dataType": "image" }, { "identifier": "id-name", "key": "name", "label": { "type": "formatted_text", "text": "Name" }, "dataType": "string" }, { "identifier": "id-occupation", "key": "occupation", "label": "Occupation", "dataType": "string" } ], "records": [ { "image": "bundle://image-1.jpg", "name": "Amelia Earhart", "occupation": "Pilot" }, { "image": "bundle://image-2.jpg", "name": "Grace Hopper", "occupation": "Computer Scientist" } ] } } ]}

See Also

Tables with JSON Data

Adding a JSON Table

Add a table to your article that displays JSON data in rows and columns.

object DataTable

The component for adding a JSON data table.

object RecordStore

The object that contains JSON data for a data table.

object DataTableSorting

A data category by which to sort the table in descending or ascending order.

object DataFormat

Properties shared by all data format obejct types.

object FloatDataFormat

The object that allows you to specify the number of digits after the decimal point for numeric values in data table cells.

object ImageDataFormat

The object that allows you to specify the minimum and maximum dimensions for images in data table cells.