Mohadeseh
Mohadeseh

Reputation: 366

kendo Tree List not refreshing when bind new data

I have a DropDownList and kendo Tree List in asp.net mvc core. that i want to when DropDownList selected Changes tree view has been refreshed by new data.but refresh data not working:

@(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);
                   
                }
                
             });

Upvotes: 0

Views: 442

Answers (1)

Zahra Nikkhah
Zahra Nikkhah

Reputation: 50

you should pass your parameter to method 'read' of kendoTreeList,please delete ajax request box and insert this code instead of:

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

Upvotes: 2

Related Questions