简体   繁体   English

Kendo Mvc Treelist 显示“没有可用的记录”。 升级后

[英]Kendo Mvc Treelist shows "No records available." after upgrading

I am using Kendo for Asp.Net MVC in my application.我在我的应用程序中使用 Kendo for Asp.Net MVC。 Recently I upgraded to version 2021.2.616 After that the treelist stopped showing data.最近我升级到版本 2021.2.616 之后,树列表停止显示数据。 Only "No records available."只有“没有可用的记录”。 is shown显示树列表中没有数据

The ajax is returning data correctly. ajax 正确返回数据。

There are no console errors or any other errors shown.没有显示控制台错误或任何其他错误。

Some additional info:一些额外的信息:

This is the code that returns the data from action这是从动作返回数据的代码

IEnumerable<CategoryModel> result = ... linq query here ...;
return Json(result.ToTreeDataSourceResult(request,
                    e => e.Id,
                    e => e.ParentCategoryId,               
                    e => e                   
                    ));

The problem was with value of parent category - ie ParentCategoryId.问题在于父类别的值 - 即 ParentCategoryId。

When using 2021.2.616 : For root - ie if there is no parent - the value should be 0 (zero).使用 2021.2.616 时:对于 root - 即如果没有父级 - 该值应为 0(零)。 Null wont work.空不会工作。

The confusion was because in the previous Kendo version that we had (2019.x.xxx), this was not the case.混淆是因为在我们之前的剑道版本(2019.x.xxx)中,情况并非如此。 It could either be null or zero.它可以是空值或零。 In my case the value was null.在我的情况下,该值为空。

So, I hope this answer helps those who are upgrading to newer versions of kendo.所以,我希望这个答案可以帮助那些升级到更新版本剑道的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM