[Tree] Don't assume context capability is present

Addresses #753 (newly-created objects may not have context,
causing errors when these are encountered by TreeNodeView)
This commit is contained in:
Victor Woeltjen
2016-03-16 14:04:03 -07:00
parent d30532a8bc
commit 73b7365ae2
2 changed files with 18 additions and 3 deletions

View File

@ -81,13 +81,13 @@ define([
};
function getIdPath(domainObject) {
var context = domainObject && domainObject.getCapability('context');
function getId(domainObject) {
return domainObject.getId();
}
return domainObject ?
domainObject.getCapability('context').getPath().map(getId) :
[];
return context ? context.getPath().map(getId) : [];
}
TreeNodeView.prototype.value = function (domainObject) {