kendo ui取消树视图下降 [英] kendo ui cancel treeview drop
本文介绍了kendo ui取消树视图下降的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
var newDiv = $(document.createElement('div'));
newDiv.html('您确定要移动项目:'+ title);
newDiv.dialog({
autoOpen:true,
width:600,
按钮:{
保存:function(){
$(这个).dialog(close);
},
取消:function(){
$(this).dialog(close);
e.setValid = false;
}
}
});
我也尝试在drag事件上执行同样的代码,并使用 e.preventDefault();
没有更多的运气
解决方案
drop
事件处理程序提供 setValid
函数,可以防止发生丢失。例如:
function onDrop(e){
e.setValid(confirm('项目在这里?'));
}
$(#treeView)。kendoTreeView({
// ...
dragAndDrop:true,
drop:onDrop
});
我写了一个小提琴,演示如何运作。
i have a TreeView that once the user drops the item to the desired position, it displays a dialog box and asks for confirmation, if the user selects cancel, how would i also cancel the placement of the item so it goes back to its original position? my current code is below but isnt working:
var newDiv = $(document.createElement('div'));
newDiv.html('Are you sure you want to move the item: ' + title);
newDiv.dialog( {
autoOpen: true,
width: 600,
buttons: {
"Save": function () {
$(this).dialog("close");
},
"Cancel": function () {
$(this).dialog("close");
e.setValid = false;
}
}
});
I have also tried doing the same kind of code on the dragend event and using e.preventDefault();
with no more luck
解决方案
The drop
event handler provides the setValid
function, which can prevent the drop from occurring. For example:
function onDrop(e) {
e.setValid(confirm('Do you wish to move this item here?'));
}
$("#treeView").kendoTreeView({
// ...
dragAndDrop: true,
drop: onDrop
});
I've written a fiddle which demonstrates how this works.
这篇关于kendo ui取消树视图下降的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文