This is a migrated thread and some comments may be shown as answers.

Treelist prevent selection

1 Answer 308 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Philippe
Top achievements
Rank 1
Philippe asked on 24 Nov 2015, 08:26 PM

Hi everyone, I'm trying to implement a click validation on the selection event for the treelist.

All I've fount is this inspering article http://www.telerik.com/forums/disable-treeview-selection 

Claiming the preventDefault would do the job.

So I've tried placing an avent in Select and selectable with no succes.

change is the only event triggering

executing e.preventDefault does run that script inside Kendo.all.js

var preventDefault = function() {

   this._defaultPrevented = true;
};

then the trigger function "return e._defaultPrevented === true;"

 but it seem that your change function will not listen to it.

 _change: function() {

   this.trigger(CHANGE);
 },

 It seem like a bug

Am i missing anything?

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 26 Nov 2015, 11:38 AM
Hello,

In order prevent selection you can handle the click event of the row in the treelist and remove the relevant css class:
$("#treelist").on("click", "tr[role='row']", function (e) {
                    if (//...some condition...//) {
                        var row = $(e.target).closest("tr[role='row']");
                        row.removeClass("k-state-selected")
                    }
                });


Regards,
Marin
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
TreeList
Asked by
Philippe
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or