javascript - How can I restricting grouping and draging inside a Kendo UI treeView -
i got kendoui treeview this:
at moment possible switch first level elements via drag , drop (group, rect-1.., line, text) should not possible group elements, drag elements inside group outside group. should possible switch elements inside group , switch elements on first level.
how can that?
i trying answer , hope meet exact behavior want
it should not possible group elements, drag elements inside group outside group
- by i'm guessing want element/node can't change it's level (first if condition)
it should possible switch elements inside group
by i'm guessing want inside 2nd element on each 1st element, cannot switch parent (first if condition)
my (second if condition) doesn't allow create 3rd element dragging 2nd element on 2nd element
my (third if condition ) allow moving 1st element , comment i'm not sure mean allowing first element change
add drop function treeview, add code :
drop: function(e) { var data = $('#treeview-left').data('kendotreeview').dataitem(e.sourcenode); var newdata = $('#treeview-left').data('kendotreeview').dataitem(e.destinationnode); // not allow changing levels if (data.parent() != newdata.parent() ) { console.log("do not allow changing levels"); e.setvalid(false); } // not allow adding leaf node if (!newdata.haschidren && e.dropposition == "over") { console.log("do not allow adding leaf node"); e.setvalid(false); } //only allow 1st level element drag drop not 2nd element //if (data.parent()){ // console.log("only allow 1st parent drag drop"); // e.setvalid(false); // } },
Comments
Post a Comment