DataDescriptor
The object for providing the data type, data formatting, and label for a field in a table.
Declaration
object DataDescriptorProperties
| Name | Type | Description |
|---|---|---|
dataType Required | string | The data type. Valid values:
|
key Required | string | 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 | (FormattedText | string) | 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 | DataFormat | The object that sets some additional formatting preferences if you are using the |
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. |
Mentioned in
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"
}
]
}
}
]
}