SitecoreNoob
SitecoreNoob

Reputation: 311

Kendo UI Treeview: suppress expand/collapse and select child nodes on dblclick

I have a Kendo UI Treeview with checkboxes set up on my page

I want to suppress expand/collapse of child nodes on double click and check child nodes on dblclick

i have tried

 $("#treeview").kendoTreeView({ }).on('dblclick', '.k-in', function (event) {

            event.preventDefault();
            alert('dblclick');
        }).data("kendoTreeView")

prevent default does not seem to supress expand and collapse

Upvotes: 1

Views: 3680

Answers (3)

Robert
Robert

Reputation: 722

To get rid of expand on dblclick:

$('#treeview').off('dblclick', '.k-in:not(.k-state-disabled)');

To get rid of expand on dblclick & add something else instead:

$('#treeview').off('dblclick', '.k-in:not(.k-state-disabled)')
    .on('dblclick', '.k-in:not(.k-state-disabled)', function(evt) {
        // your stuff
    });

Upvotes: 1

user5525029
user5525029

Reputation: 31

try this: $("#treeview").unbind("dblclick");

Upvotes: 3

Devendra Soni
Devendra Soni

Reputation: 1934

Hi you don't want to expand or collapse on double click event then do it like this...

 $("#treeview").kendoTreeView({ }).on('dblclick', '.k-in', function (event) { 
     alert('dblclick');
     return false;
}).data("kendoTreeView")

just add one more line return false in your code. this is working fine..

see the working example:-http://jsfiddle.net/GaFd6/37/ in above example if you will double click on tree then node will not expand.

Thanks

Upvotes: 2

Related Questions