Skip to main content

DataCollection overview

A set of APIs that allow you to work with data of a component. Applicable to Chart, Combobox, DataView, Grid, List.

Methods

NameDescription
add()adds a new item to the component
changeId()changes the id of an element of a data collection
copy()creates a copy of an item at the defined position
exists()checks whether the specified item exists in the component
filter()filters data items in a component
find()finds the item that corresponds to the specified rule
findAll()finds all the items that correspond to the specified rule
forEach()iterates over all items of a data collection
getFilters()returns an object with the applied filters
getId()returns the id of the item by its index
getIndex()returns the index of the item by its id
getInitialData()returns the initial values of the items of a widget initialized in a data collection
getItem()returns the object of an item by its id
getLength()returns the number of all elements of a data collection
group()groups data in a collection that has a plain tree-like structure according to the specified order and additional configuration
isDataLoaded()checks whether the specified data range is loaded from the server
isGrouped()checks whether a data collection is grouped at the moment
isSaved()checks whether the changes made in a data collection are saved
load()loads data from an external file
map()iterates through all items of the component
mapRange()returns a new array of the items correspond to the specified parameters
move()moves an item to the defined position
parse()loads data from a local data source
reduce()reduces the array to a single value
remove()deletes the specified item from the component
removeAll()deletes all items from the component
resetFilter()resets the active filters
save()saves changes made in a data collection to the server side
serialize()serializes the component data into JSON, XML or CSV format
sort()sorts data items in a component
ungroup()resets the applied data grouping
update()updates properties of the item

Events

NameDescription
afterAddfires after adding a new item into a data collection
afterGroupfires after data is grouped
afterLazyLoadfires after getting a response from the server
afterRemoveFires after removing an item from a data collection
afterUnGroupfires after data is ungrouped
beforeAddfires before adding a new item into a data collection
beforeGroupfires before grouping of data has started
beforeLazyLoadfires before sending a request to the server
beforeRemovefires before removing an item from a data collection
beforeUnGroupfires before ungrouping of data has started
changefires when a data collection is modified
filterfires after filtering a data collection
loadfires when items are loaded in a data collection
loadErrorfires when loading of data fails
removeAllfires when all items are removed from a data collection
Ways of applying events

To call the event of DataCollection, you may use either of the two syntaxes:

  • common syntax (via the data object of the component)
chart.data.events.on("afterAdd", function(newItem){
console.log("A new item is added");
});
  • or short syntax (right through the component)
chart.events.on("afterAdd", function(newItem){
console.log("A new item is added");
});