mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 15:18:12 +00:00
[Tree] Change selection on click
This commit is contained in:
@ -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) :
|
||||
[];
|
||||
|
Reference in New Issue
Block a user