如果我适用,则filterable不适用于网格,否则网格中的其他条件

编程入门 行业动态 更新时间:2024-10-13 02:14:13
本文介绍了如果我适用,则filterable不适用于网格,否则网格中的其他条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我们在Kendo网格列中应用了else条件,则可过滤器不适用于该特定列

if we apply if else condition in Kendo grid column then filterable not working for that particular column

{ field: " ", title: "Compliance Status", width: "180px", template: "# if(WithinDueDt == 'Y'){# Completed on time #} else if(Ongoing == 'Y'){# Ongoing #} else if(CompletedbutDelayed == 'Y'){# Completed but Delayed #} else if(OngoingbutDelayed == 'Y'){# Ongoing but Delayed #} #" }

推荐答案

Kendo网格排序和过滤功能基于field值而不是基于template值. 这里没有字段映射到列,所以它不起作用.

Kendo Grid sorting and filtering functionality works based on the field value not based on the template value. Here there is no field mapped to the column, so it is not working.

要解决此问题:从后端传递ComplianceStatus值,而不是在网格中编写模板.

To resolve this issue: Pass the complianceStatus value from backend instead of writing template in grid.

在对象中创建一个String字段,并根据上述条件为该字段设置值,然后将该字段映射到网格中(不需要模板).

Create a String field in the object and set value to that field based on the above conditions and then map that field in the grid, template not required.

例如,如果您使用java作为后端:

For example if you are using java as backend:

private String complianceStatus; private String getComplianceStatus(){ complianceStatus = ""; if(WithinDueDt == "Y"){ complianceStatus = "Completed on time" } else if(Ongoing == "Y"){ complianceStatus = "Ongoing" } else if(CompletedbutDelayed == "Y"){complianceStatus = "Completed but Delayed"} else if(OngoingbutDelayed == "Y"){complianceStatus = "Ongoing but Delayed"} return complianceStatus ; }

在网格列中:

{ field: "complianceStatus", title: "Compliance Status", width: "180px" }

更多推荐

如果我适用,则filterable不适用于网格,否则网格中的其他条件

本文发布于:2023-10-26 17:43:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1530878.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:网格   不适用于   条件   filterable

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!