MindFusion.Charting for JavaScript Programmer's Guide
IEnumerable.contains Method
See Also
 






Checks if the given element is present in the collection.

Namespace: MindFusion.Common.Collections
File: IEnumerable.js

 Syntax

JavaScript  Copy Code

function contains (item)

 Parameters

item

Type: Object
Object. The object to check for.

 Return Value

Type: Boolean
Boolean. True if the element is found, otherwise false.

 Example

The following code checks if a TreeNode element called "div" is contained within the collection of items of a TreeView instance.

JavaScript  Copy Code

// create a tree node that will be a root in our hierarchy
var root = new ui.TreeNode("body");
root.expanded = true;

var span = new ui.TreeNode("span");
var div = new ui.TreeNode("div");
var p = new ui.TreeNode("p");

var elements = [span, div, p];
root.items.addRange(elements);
.......................

if (root.items.contains(div))
{
 //do something
}

 See Also

IEnumerable Members
IEnumerable Class
MindFusion.Common.Collections Namespace