如果我们在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不适用于网格,否则网格中的其他条件
发布评论