Display Enum description in Jqgrid instead of the Enum

jqgrid, jquery, struts2

Solution

You can write a custom formatter to achieve this. For example:

formatStatus: function (cellvalue, options, rowObject){
   if (cellvalue == "ACTIVE")
       return "Active";
   return "InActive";
}

Then make sure to use the formatter from your colmodel:

{name: 'status', formatter: formatStatus, ...},

Does that help?

Problem

I have an Enum like this written in 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; } } ``` This enum is a property in a jqGrid. But it always display the enum i.e. ACTIVE or IN_ACTIVE. I want the jqgrid to show Active and InActive. Thanks

Original source