Adds an element to the collection at the specified index.
Namespace: MindFusion.Common.Collections
File: IEnumerable.js
JavaScript Copy Code |
---|
function insert (index, item) |
Number. The index.
Object. The object to add.
The following code inserts a TreeNode at the second position among the items of a TreeView root:
JavaScript Copy Code |
---|
var treeView = new ui.TreeView(document.getElementById("treeView")); // create a tree node that will be a root in our hierarchy var span = new ui.TreeNode("span"); var elements = [span, div, p]; var block = new ui.TreeNode("block"); |