Skip to main content

DataCollection overview

A set of APIs that allow you to work with data of a diagram. The API can be used both in the diagram and in the editor.

Methods

NameDescription
add()Adds a new item to the diagram
copy()Creates a copy of an item at the defined position
eachChild()Iterates through the children of the specified item
eachParent()Iterates through all parents of the specified item
exists()Checks whether the specified item exists in the diagram
filter()Filters items in the diagram
find()Finds the item that corresponds to the specified parameters
findAll()Finds all the items that correspond to the specified parameters
getId()Returns the id of the item by its index
getIndex()Returns the index of the item by its id
getItem()Returns the object of an item by its id
getNearId()Looks for a nearest item relative to the specified one
getRoot()Returns the id of the root item by the id of its child
getRoots()Returns an array with ids of all root items of the diagram
load()Loads data from an external file
map()Iterates through all items of the diagram
move()Moves an item to the defined position
parse()Loads data from a local data source
remove()Deletes the specified item from the diagram
removeAll()Deletes all items from the diagram
serialize()Serializes the diagram data into an array of JSON objects
update()Updates properties of the item

Events

NameDescription
afterAddFires after adding an item
afterRemoveFires after removing an item from a data collection
beforeAddFires before adding an item
beforeRemoveFires after removing an item from a data collection
changeFires on changes in the dataset of the diagram
loadFires when data is loaded into the diagram