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

Commit 2cd3a5a

Browse files
authored
Merge pull request #136 from symfony-cmf/add_option
disable activation
2 parents 096b32d + ea37b21 commit 2cd3a5a

File tree

5 files changed

+29
-18
lines changed

5 files changed

+29
-18
lines changed

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

Lines changed: 12 additions & 1 deletion
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;
@@ -290,9 +292,18 @@ export class FancytreeAdapter {
290292
return node.data.refPath == refPath;
291293
});
292294
};
295+
296+
// We do not want to do anything on activation atm.
297+
this.$tree.fancytree('option', 'beforeActivate', (event, data) => {
298+
if (!this.boundToInput) {
299+
return false;
300+
}
301+
});
293302
}
294303

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

0 commit comments

Comments
 (0)