获取更新的Kendo Tree View数据源

问题描述 投票:1回答:1

我正在使用数据源显示树视图,但在拖放之后会有更改,我必须得到更改的新数据源。我怎么做?

$.ajax({
         type: "POST",
         url: "TestMenu.aspx/GetMenuData",
         contentType: "application/json; charset=utf-8",
         dataType: "json",
         success: function (data) {
         $("#treeview").kendoTreeView({
                 dragAndDrop: true,
                 dataSource: $.parseJSON(data.d)
             });
          }
         });
kendo-ui kendo-treeview
1个回答
8
投票

所以,我终于完成了任务。为那些正在寻找与我相同答案的人发布答案。 将通话更改为:

       $.ajax({
           type: "POST",
            url: "TestMenu.aspx/GetMenuData",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                $("#treeview").kendoTreeView({
                    dragAndDrop: true,
                    dataSource: $.parseJSON(data.d)
                }).data("kendoTreeView");
            }
        });

然后获取更新的数据源:

var treeviewDataSource = $("#treeview").data("kendoTreeView").dataSource.view();
© www.soinside.com 2019 - 2024. All rights reserved.