in js/tree.jquery.js [2551:2611]
JqTreeWidget.prototype._selectNode = function(node, must_toggle) {
var canSelect, deselected_node, openParents, saveState;
if (must_toggle == null) {
must_toggle = false;
}
if (!this.select_node_handler) {
return;
}
canSelect = (function(_this) {
return function() {
if (_this.options.onCanSelectNode) {
return _this.options.selectable && _this.options.onCanSelectNode(node);
} else {
return _this.options.selectable;
}
};
})(this);
openParents = (function(_this) {
return function() {
var parent;
parent = node.parent;
if (parent && parent.parent && !parent.is_open) {
return _this.openNode(parent, false);
}
};
})(this);
saveState = (function(_this) {
return function() {
if (_this.options.saveState) {
return _this.save_state_handler.saveState();
}
};
})(this);
if (!node) {
this._deselectCurrentNode();
saveState();
return;
}
if (!canSelect()) {
return;
}
if (this.select_node_handler.isNodeSelected(node)) {
if (must_toggle) {
this._deselectCurrentNode();
this._triggerEvent('tree.select', {
node: null,
previous_node: node
});
}
} else {
deselected_node = this.getSelectedNode();
this._deselectCurrentNode();
this.addToSelection(node);
this._triggerEvent('tree.select', {
node: node,
deselected_node: deselected_node
});
openParents();
}
return saveState();
};