我正在尝试检测我何时在拖动项目后将其放到 TreeView 中。当我这样做时,它只是无限期地挂起以搜索 javascript 函数。有时它会在 10 秒后找到它,有时却找不到。我已经通过 Firebug 验证该函数始终在加载(并且只加载一次)。
我的Kendo UI版本是:2012.2.913
在此先感谢您的任何帮助或建议。
@(Html.Kendo().TreeView()
.Name("CompanyHierarchy")
.Events(events => events
.DragEnd("HierarchyDragEnd")
)
.BindTo(Model.Hierarchy as System.Collections.IEnumerable, mappings =>
{
mappings.For<Models.EnterpriseChildModel>(binding => binding
.Children(c => c.Children)
.ItemDataBound((item, c) =>
{
item.Text = c.Name;
})
);
})
.DragAndDrop(true))
<script type="text/javascript">
function HierarchyDragEnd(e) {
alert("here");
}</script>
我不知道它是否有帮助,但这是它“卡住”时的照片
最佳答案
对于 dragend 事件,Firefox 似乎存在错误(在 Chrome 中,您的示例运行良好)。 解决方法是延迟结果,以便像这样正确注册 dragend 事件:
function HierarchyDragEnd(e) {
setTimeout(function() {
alert('here');
}, 100);
}
关于javascript - Kendo UI TreeView DragEnd 事件崩溃极其缓慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12711864/