Adds an element to the collection at the specified index.
Namespace: MindFusion.Mapping
Package: IEnumerable.js
JavaScript Copy Code |
---|
function insert (index, item) |
Number. The index.
Object. The object to add.
The following code creates a DecorationLayer and adds Marker instances to it. Then it checks if the decoration items are more than 10 and if yes - inserts a new one at the 6th place in the collection. The decorations property is of type ObservableCollection, which derives from IEnumerable.
JavaScript Copy Code |
---|
var m = MindFusion.Mapping; var markers = new m.DecorationLayer("Images"); // create some markers with images mark = new m.Marker(); if(markers.decorations.count > 10) |