Examples › Non-standard record IDs
By default, the DataTable
will assume each record to have a property called id
, holding a unique value of a primitive data type.
The record IDs are used internally as .map()
keys and to compare records when necessary.
You can override the default ID property name by adding an idAccessor
property on the DataTable
like so:
The code above will produce the following result:
You can also use a function to generate record IDs. This is useful for composite IDs, for example, when you need to generate a unique ID based on multiple record properties:
The code above will produce the following result: