remove()
Description
Removes the specified item or all the items from the selection list when called without arguments
Usage
remove({
id: string | number
}): boolean;
//or
remove(): boolean;
Parameters
The method may take as an argument an object with the following parameter:
id
- (required) the id of the item that should be removed from the selection list
Returns
The method returns true
if unselection of an item or the list cleanup has been successful
Example
// a diagram must be created with the "select:true" option
const diagram = new dhx.Diagram("diagram_container", {
select: true
});
// loading data
diagram.data.parse(data);
console.log(diagram.selection.getIds()); // -> ["1", "2", "3"]
diagram.selection.remove({ id: "3" }); // -> returns true if the item has been unselected
console.log(diagram.selection.getIds()); // -> ["1", "2"]
When called without arguments, the method clears the selection list:
// a diagram must be created with the "select:true" option
const diagram = new dhx.Diagram("diagram_container", {
select: true
});
// loading data
diagram.data.parse(data);
console.log(diagram.selection.getIds()); // -> ["1", "2", "3"]
// removes all the items from the selection list
diagram.selection.remove();
console.log(diagram.selection.getIds()); // -> []
Change log: Updated in v6.0
Related articles:
Related samples: Diagram. Selection. Item selection