Skip to main content

node.collection

NodeCollection : d2/sdk/models/node.collection

Represents an arbitrary collection of NodeModels. Mostly used in the context of command execution.

Even if the collection is instantiated with liternal properties, it maps those propoerties into instance of NodeModel.

Extends: Backbone.Collection
Example

define([
'd2/sdk/models/node.collection'
], function(NodeCollection){
'use strict';

var nodeCollection = new NodeCollection([
{id: '0c0015fa8000291e'},
{id: '0b0015fa80005598'}
]);

console.log('There are ' + nodeCollection.length + ' models');
console.log('First model is with id : ' + nodeCollection.at(0).get('id'));
});