如果我适用,则filterable不适用于网格,否则网格中的其他条件 [英] filterable is not working for grid if i am apply if else condition in grid

查看:115
本文介绍了如果我适用,则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不适用于网格,否则网格中的其他条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆