Uch*_*nwu 5 jquery struts2 jqgrid
我有一个用Java编写的Enum:
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;
}
}
Run Code Online (Sandbox Code Playgroud)
此枚举是jqGrid中的属性.但它始终显示枚举,即ACTIVE或IN_ACTIVE.我希望jqgrid显示Active和InActive.谢谢
您可以编写自定义格式化程序来实现此目的。例如:
formatStatus: function (cellvalue, options, rowObject){
if (cellvalue == "ACTIVE")
return "Active";
return "InActive";
}
Run Code Online (Sandbox Code Playgroud)
然后确保使用 colmodel 中的格式化程序:
{name: 'status', formatter: formatStatus, ...},
Run Code Online (Sandbox Code Playgroud)
这有帮助吗?