kendo 绑定新数据时树列表不刷新
kendo Tree List not refreshing when bind new data
我在 asp.net mvc 核心中有一个 DropDownList 和 kendo 树列表。当 DropDownList 选择 Changes 树视图时,我想用新 data.but 刷新数据不工作:
@(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);
}
});
您应该将参数传递给 kendoTreeList 的方法 'read',请删除 ajax 请求框并插入此代码而不是:
$('#tree_formActions').data("kendoTreeList").dataSource.read({roleId:id});
我在 asp.net mvc 核心中有一个 DropDownList 和 kendo 树列表。当 DropDownList 选择 Changes 树视图时,我想用新 data.but 刷新数据不工作:
@(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);
}
});
您应该将参数传递给 kendoTreeList 的方法 'read',请删除 ajax 请求框并插入此代码而不是:
$('#tree_formActions').data("kendoTreeList").dataSource.read({roleId:id});