DataSource
This section describes how you can provide a data set and how a DikeGrid instance treats that data set.
Live examples
In-Memory DataSource live example.
Custom DataSource live example.
Specifying data
Every DikeGrid instance accepts data from an Array
, Observable< Array>
, a DikeGridDataSource
, or simply a DataSource
.
Remember, the DataSource
definition is an abstract
class with two methods: connect()
and disconnect()
. Therefore, you can provide an instance of a class that derives from the DataSource
class.
Depending on the data you provide, there are two types of DataSource: an In-Memory DataSource and a Custom DataSource.
Wrapping data entries
It does not matter how you provide your data set. The DikeGrid will wrap every data entry in a DikeGridDataRowEntry
instance.
The DikeGridDataRowEntry
wrapper helps to know several features during execution, for instance, when the user modifies a data row or when it is selected, the row status, among others.
For further details, see the DikeGridDataRowEntry
definition.
Once the DikeGrid receives and wraps the data, it assigns and emits a unique id. You can get this id by listening to the dataDeliveryIdChange
event.
Indeed, a DikeGrid instance will send a unique id every time you provide a new set of entries. It means that you can have an Observable or a DikeGridDataSource
, and if you change the entries set, the DikeGrid will wrap these new entries.
Let us listen to the dataDeliveryIdChange
event:
Open your dev console to see the emitted id.
The DikeGrid internally creates a DikeGridDataSource
instance to wrap every data entry.
Be aware that every time a DikeGrid instance wraps the provided entries, it resets the edition and selection operations. It means that the DikeGrid removes the history of changes and deselects rows.
Row Ids
The DikeGrid sets a unique id number for every row during the wrapping operation. This id number is a consecutive number starting at the zero number.
You can open any live example, go to the Floating Configuration Panel, scroll to the Rows section and mark the Row Id checkbox.
Timestamp / Row status
Other values that the DikeGrid creates and assigns to every row are the timestamp and the initial row status.
The timestamp corresponds to the row creation time and the row status to the Read
value. The Read
value means that the user has not modified the row.
The DikeGrid uses the row status and the timestamp properties to manage the edition operations. See the Row Edition section.
Last updated