Sha256: a1d952b0773908039b29e646b4383798daa9bbf304517eebbf9511615e589680

Contents?: true

Size: 682 Bytes

Versions: 7

Compression:

Stored size: 682 Bytes

Contents

---
title: onCanSelectNode
name: options-oncanselectnode
---

You can set a function to override if a node can be selected. The function gets a node as parameter, and must return true or false.

For this to work, the option 'selectable' must be 'true'.

{% highlight js %}
// Example: nodes with children cannot be selected
$('#tree1').tree({
    data: data,
    selectable: true
    onCanSelectNode: function(node) {
        if (node.children.length == 0) {
            // Nodes without children can be selected
            return true;
        }
        else {
            // Nodes with children cannot be selected
            return false;
        }
    }
});
{% endhighlight %}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
iqvoc-4.12.1 vendor/assets/bower_components/jqtree/_entries/21_oncanselectnode.md
iqvoc-4.12.0 vendor/assets/bower_components/jqtree/_entries/21_oncanselectnode.md
iqvoc-4.11.1 vendor/assets/bower_components/jqtree/_entries/21_oncanselectnode.md
iqvoc-4.11.0 vendor/assets/bower_components/jqtree/_entries/21_oncanselectnode.md
iqvoc-4.10.0 vendor/assets/bower_components/jqtree/_entries/21_oncanselectnode.md
iqvoc-4.9.0 vendor/assets/bower_components/jqtree/_entries/21_oncanselectnode.md
iqvoc-4.8.2 vendor/assets/bower_components/jqtree/_entries/21_oncanselectnode.md