Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.

Commit ea37b21

Browse files
committed
Do allow activation when used as form type
1 parent bfb4911 commit ea37b21

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/Resources/assets/js/adapter/fancytree.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export class FancytreeAdapter {
5050
this.requestData = options.request;
5151
this.rootNode = options.root_node || '/';
5252
this.useCache = undefined === options.use_cache ? true : options.use_cache;
53+
this.boundToInput = false;
5354

5455
if (options.dnd && undefined == options.dnd.enabled) {
5556
options.dnd.enabled = true;
@@ -116,7 +117,8 @@ export class FancytreeAdapter {
116117
children: [],
117118
actions: {},
118119
refPath: requestNode.path.replace('\/', '/').replace('//', '/'),
119-
type: requestNode.payload_type
120+
type: requestNode.payload_type,
121+
unselectable: true
120122
};
121123

122124
this.pathKeyMap[fancytreeNode.refPath] = key;
@@ -292,12 +294,16 @@ export class FancytreeAdapter {
292294
};
293295

294296
// We do not want to do anything on activation atm.
295-
this.$tree.fancytree('option', 'beforeActivate', () => {
296-
return false;
297+
this.$tree.fancytree('option', 'beforeActivate', (event, data) => {
298+
if (!this.boundToInput) {
299+
return false;
300+
}
297301
});
298302
}
299303

300304
bindToInput($input) {
305+
this.boundToInput = true;
306+
301307
// output active node to input field
302308
this.$tree.fancytree('option', 'activate', (event, data) => {
303309
$input.val(data.node.data.refPath);

0 commit comments

Comments
 (0)