我有一个用 Java 编写的枚举:
public enum Status
{
ACTIVE("Active"), IN_ACTIVE("InActive");
Status(String desc)
{
this.description = desc;
}
private String description;
public String getDescription()
{
return description;
}
public void setDescription(String desc)
{
this.description = desc;
}
}
此枚举是 jqGrid 中的一个属性。但它始终显示枚举,即 ACTIVE 或 IN_ACTIVE。我希望 jqgrid 显示事件和非事件。 谢谢
最佳答案
你可以写一个custom formatter为了达成这个。例如:
formatStatus: function (cellvalue, options, rowObject){
if (cellvalue == "ACTIVE")
return "Active";
return "InActive";
}
然后确保使用 colmodel 中的格式化程序:
{name: 'status', formatter: formatStatus, ...},
这有帮助吗?
关于jquery - 在 Jqgrid 中显示 Enum 描述而不是 Enum,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10102947/