Documentation

Report Edit

Data Adapters

In CxJS, data adapters are used under the hood to convert raw data into a format that can be easily consumed by various components such as Grid, List, Repeater, or those like Tree Grid with tree structure. Data adapters come in three types: array adapter, group adapter, and tree adapter.

Array Adapter

Transforms flat lists through operations such as mapping or sorting. See Repeater for more.

PropertyDescriptionType
indexName

Alias used to expose record index. Defaults to $index.

string
keyField

Configures which field forms the record key.

string
recordName

Alias used to expose record data. Defaults to $record.

string
recordsBinding

Specifies the location for storing records.

string
immutable

Indicate that the data in the parent store should not be mutated. Defaults to false.

boolean
recordsAccessor

Configuration for accessing and modifying records data.

object
sealed

Indicate that the data in record stores should not be mutated.

boolean

Group Adapter

Groups data based on the provided key. Used in components such as List and Grid. See grouping in lists for more.

PropertyDescriptionType
aggregates

Defines computed values based on grouped records, e.g. count of elements in a group.

record
groupName

Alias used to expose group data. Defaults to $group.

string
groupRecordsAlias

Alias used to expose group records data outside the group.

string
groupRecordsName

Alias used to expose records data within a group. Defaults to $records.

string
groupings

Configures criteria for hierarchically grouping records. Allows configuring header and footer.

object
indexName

Alias used to expose record index. Defaults to $index.

string
keyField

Configures which field forms the record key.

string
recordName

Alias used to expose record data. Defaults to $record.

string
recordsBinding

Specifies the location for storing records.

string
immutable

Indicate that the data in the parent store should not be mutated. Defaults to false.

boolean
recordsAccessor

Configuration for accessing and modifying records data.

object
sealed

Indicate that the data in record stores should not be mutated.

boolean
sortOptions

Options for data sorting. See Intl.Collator options for more info.

record

Tree Adapter

Structures data in a tree-like format, enabling the expansion of individual records. See Tree Grid for more.

PropertyDescriptionType
childrenField

Alias used to expose children data. Default is $children.

string
foldersFirst

A boolean value indicating whether folders should be displayed before leaves. Defaults to true.

boolean
indexName

Alias used to expose record index. Defaults to $index.

string
keyField

Configures which field forms the record key.

string
recordName

Alias used to expose record data. Defaults to $record.

string
recordsBinding

Specifies the location for storing records.

string
expandedField

Alias pointing to a boolean value indicating the record's expansion status. Defaults to $expanded.

string
hideRootNodes

If true, root nodes will be hidden, and their children nodes will be displayed as the top-level nodes. Defaults to false.

boolean
immutable

Indicate that the data in the parent store should not be mutated. Defaults to false.

boolean
leafField

Alias pointing to a boolean value indicating whether the node is leaf. Defaults to $leaf.

string
loadedField

Alias pointing to a boolean value indicating whether the node has loaded its children. Defaults to $loaded.

string
loadingField

Alias pointing to a boolean value indicating whether the node is currently loading its children. Defaults to $loading.

string
onLoadError

An error occured while loading the children data.

function
recordsAccessor

Configuration for accessing and modifying records data.

object
restoreExpandedNodesOnLoad

A boolean flag that determines whether the expanded state of the nodes should be restored when the data is loaded.

boolean
sealed

Indicate that the data in record stores should not be mutated.

boolean

These adapters serve specific purposes in manipulating and organizing data for integration with CxJS components, providing a flexible and efficient way to handle various data structures across different application needs.