[Tree] Change selection on click

This commit is contained in:
Victor Woeltjen
2016-03-11 17:32:57 -08:00
parent 217e697079
commit a3a9393d1b
3 changed files with 16 additions and 8 deletions

View File

@ -29,7 +29,7 @@ define([
], function ($, nodeTemplate, ToggleView, TreeLabelView) {
'use strict';
function TreeNodeView(subtreeFactory) {
function TreeNodeView(subtreeFactory, selectFn) {
this.li = $('<li>');
this.toggleView = new ToggleView(false);
@ -49,6 +49,10 @@ define([
this.labelView = new TreeLabelView();
$(this.labelView.elements()).on('click', function () {
selectFn(this.activeObject);
}.bind(this));
this.li.append($(nodeTemplate));
this.li.find('span').eq(0)
.append($(this.toggleView.elements()))
@ -80,7 +84,7 @@ define([
function getId(domainObject) {
return domainObject.getId();
}
return domainObject ?
domainObject.getCapability('context').getPath().map(getId) :
[];