如果我们在Kendo网格列中应用else条件,则可过滤器不适用于该特定列
List<RootObject> myData = JsonConvert.DeserializeObject<List<RootObject>>(json);
答案 0 :(得分:0)
Kendo网格排序和过滤功能基于field
值而不是基于template
值。
这里没有字段映射到列,所以它不起作用。
要解决此问题:从后端传递ComplianceStatus值,而不是在网格中编写模板。
在对象中创建一个String
字段,并根据上述条件为该字段设置值,然后将该字段映射到网格中(不需要模板)。
例如,如果您使用java作为后端:
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" }