【问题标题】:kendo Tree List not refreshing when bind new data绑定新数据时剑道树列表不刷新
【发布时间】:2021-07-19 10:37:57
【问题描述】:

我在 asp.net mvc 核心中有一个 DropDownList 和剑道树列表。我想当 DropDownList 选择更改树视图已被新数据刷新。但刷新数据不起作用:

@(Html.Kendo().DropDownListFor(d => d.RoleId)
                            .DataSource(d=> d.Read(r=> r.Action("RoleList", "Role", new { }).Type(HttpVerbs.Post)))
                            .DataTextField("Name")
                            .DataValueField("id")
                            .Events(d => d.Change("winRolePermissionDetails.onChangeCat"))
                            )

winRolePermissionDetails = {
....
onChangeCat: function (e)
        {
            debugger;
            var id = $("#RoleId").val();
            if (id <= 0)
                return;

            $.ajax({
            url: "/RolePermissions/FormActionList/" + '?roleId=' + id,
            dataType: "json",
            cache: false,
            type: 'GET',
            //data: {  roleId=id },
            success: function (result) { 
                   var tvProjeto = $('#tree_formActions').data("kendoTreeList");
                   tvProjeto.dataSource.data(result);
                   
                }
                
             });

【问题讨论】:

  • 到底是怎么回事?浏览器开发工具中的任何错误? ajax 网络调用是否发生,您的成功函数是否被调用?还请包括树视图的配置代码。
  • 试试tvProjeto.dataSource.read(result);

标签: asp.net-mvc asp.net-core .net-core kendo-ui tree


【解决方案1】:

您应该将参数传递给 kendoTreeList 的“读取”方法,请删除 ajax 请求框并插入此代码而不是:

$('#tree_formActions').data("kendoTreeList").dataSource.read({roleId:id});

【讨论】:

    猜你喜欢
    • 2023-04-08
    • 2014-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-18
    • 1970-01-01
    • 2013-08-29
    相关资源
    最近更新 更多