Kendo UI重新加载Treeview [英] Kendo UI reload treeview

查看:229
本文介绍了Kendo UI重新加载Treeview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过ajax用kendo ui加载一个复杂的树视图,因为我需要用一个请求加载树(工作正常):

I load a complex treeview with kendo ui via ajax because I need to load the tree with one request (works fine):

$(document).ready(function() {    
    buildTree();        
});

function buildTree(){
    $.getJSON("admin_get_treedata.php", function (data) {
        $("#treeview").kendoTreeView({
            select: function(item) { editTreeElement(item,'tree'); },
            dataSource: data
        });
    })
}

如果我尝试通过ajax更改某些数据后重新加载完整的树,则新的构建树将无法正常工作,并且不会更新文本.

If I try to reload the complete tree after changing some data via ajax the new build tree does not work correct and does not update the text.

  $.ajax({
        type: 'POST',
        url: 'ajax/ajax_update_layer.php',
        data: {
            layerid:id,
            ...
        },
        success: function(data){
                      buildTree();
                }
        });   

我可以做什么? 谢谢 斯文

What can Ido? Thanks Sven

推荐答案

在ajax成功回调中尝试

try this on ajax success callback

var data = $("#treeView").data('kendoTreeView');
    data.dataSource.read();

这篇关于Kendo UI重新加载Treeview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆