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






Returns the first element in the collection.

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

 Syntax

JavaScript  Copy Code

function first ()

 Return Value

Type: Object
Object. The first element in the collection.

 Example

The following code checks if the first item in the collection of items in a TreeNode is span:

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.first() == span)
{
 //do something
}

 See Also

IEnumerable Members
IEnumerable Class
MindFusion.Common.Collections Namespace