Control Item
Copy
A control item represents an item displayed in the collection control, either at the root level or as a child. It provides an API to set and retrieve property values, as well as to add or remove child items from the parent control item.
getItemId
Once you have controlItem that represents a row in collection controls, associated relationshipId/itemId can be obtained by calling this function.var itemId = controlItem.getItemId();
getRelatedId
Once you have controlItem that represents a row in collection controls, associated relatedId can be obtained by calling this function.
var relationshipId = controlItem.getRelatedId();
isItemNew
Once you have controlItem that represents a row in collection controls, associated isNew state can be obtained by calling this function. Return true if the item is newly added or inserted.var isItemNew = controlItem.isItemNew()
getValue
Once you have a controlItem representing a row in a collection control, you can retrieve the value of a specific cell by providing the column’s property name. If the controlItem represents relationship data, and you need to access a property of the related item, the columnPropertyName should be specified in the format “related.relatedItemPropertyName”.
var cellValue = controlItem.getValue(columnPropertyName);
setValue
Once you have itemControl that represents a row in collection controls, a particular cell value in that row can be set by passing column property name and cell value. If the controlItem represents relationship data, to set relatedItem property value, you need to pass columnPropertyName as “related.relatedItemPropertyName”.
itemControl.setValue(columnPropertyName, cellValue);
getChildItems
Once you have controlItem that represents a row in worksheet, treeTable, structure, graph controls, its child items can be retrieved by passed child relationshipName.
var childControlItems = controlItem.getChildItems(childRelationshipName);
getChildItem
Once you have controlItem that represents a row in worksheet, treeTable, structure, graph controls, its child item can be retrieved by passing child relationshipName and child relationshipId
var childControlItem = controlItem.getChildItem(childRelationshipName, childRelationshipId);
getChildItemByRelatedId
Once you have controlItem that represents a row in collection controls, childControlItem can be obtained given that child relationshipName, child relatedId.
var childControlItems = controlItem.getChildItemByRelatedId( childRelationshipName, childRelatedItemId);
addChildItem
Once you have controlItem that represents a row in collection controls, childItem can be added given that child relationshipName, child relationshipId, and itemData. It also returns newly added item in the form of childControlItem.
const itemData = {properties: {address: “Sample Data”,},relatedItem: {properties: {name: “Sample Item”,description: “Sample Desc”,},},};
var childControlItem = controlItem.addChildItem(childRelationshipName, childRelationshipId, itemData);
insertChildItem
Once you have controlItem that represents a row in collection controls, childControlItem can be inserted given that child relationshipName, child relationshipId, and insertItemId. It also returns newly added item in the form of childControlItem.
controlItem.insertChildItem(childRelationshipName, childRelationshipId, insertItemId).then((insertedChildItemControl) => {// accessing inserted ItemControl and setting its valueinsertedChildItemControl.setValue(columnPropertyName, cellValue);});
deleteChildItem
Once you have controlItem that represents a row in collection controls, childItem can be deleted from the controlItem given childRelationshiName and childRelationshipId.
controlItem.deleteChildItem(childRelationshipName, childRelationshipId);
getParentItem
Once you have controlItem that represents a node in TreeTable or Structure controls, parent item can be obtained by using this API.
var parentControlIttem = controlItem.getParentItem();
getItemType
Once you have controlItem that represents a row or node in collection controls, its relationship name can be obtained by calling this function. If the controlItem represent item from ItemProperty or reference item, then you will obtain its ItemType name.
var itemTypeName = controlItem.getItemType();
getItemConfigId
Once you have controlItem that represents a row in collection controls, associated item configId can be obtained by calling this function.var itemConfigId = controlItem.getItemConfigId();
getRelatedItemType
Once you have controlItem that represents a row or node in collection controls, its related ItemType name can be obtained by calling this function.
var relatedItemTypeName = controlItem.getRelatedItemType();