Formatting display data with JqGridColumnEditTypes.Select columns

Sep 23, 2013 at 8:25 PM
I have a select column:
[Required]
[JqGridColumnEditable(true, "BFlagTypeSelectList", "RefData", EditType = JqGridColumnEditTypes.Select)]
public int BFlagId { get; set; }
And when the row is in edit/insert mode, it displays a select list correctly.
<option>
    <option value='1'>First Flag</option>
    <option value='2'>Second Flag</option>
</option
What do I need to do for the cell to display the lookup value instead of the key in list mode?
i.e. the grid displays 2, and I'd like it to display 'Second Flag'
Coordinator
Sep 23, 2013 at 8:45 PM
Well this is one of typical jqGrid limitations. jqGrid provides a predefined formatter Select but it works only in case of static list (so either the constructor that takes value provider and method or directly through Value).

The only way for dynamic list is to send the data to jqGrid with the actual display values and use keys only for editing. In case of using this helper the way to implement this migth standard ASP.NET MVC ViewModel pattern. The sample project is doing exactly this through ProductFormattedViewModel for columns Supplier and Category.
Sep 24, 2013 at 2:58 PM
In this case, a static list is perfect as the reference data only changes a few times a year.
I've got the helper emitting the list in javascript via this overload:
public JqGridColumnEditableAttribute(bool editable, Type valueProviderType, string valueProviderMethodName);
And it's correctly painting the select list client side in edit mode, but it's still displaying the key value in list mode. I assume I need to provide a Formatter, but I have no idea where?

Here's my property for this column:
[Required]
[JqGridColumnEditable(true, typeof(BonusFlagTypeModel), "SelectListValues", EditType = JqGridColumnEditTypes.Select)]
public int BFlagId { get; set; } // BFlagID
Coordinator
Sep 24, 2013 at 7:37 PM
StormRider wrote:
... but it's still displaying the key value in list mode. I assume I need to provide a Formatter, but I have no idea where?
One more attribute should do the trick:
[Required]
[JqGridColumnFormatter(JqGridColumnPredefinedFormatters.Select)]
[JqGridColumnEditable(true, typeof(BonusFlagTypeModel), "SelectListValues", EditType = JqGridColumnEditTypes.Select)]
public int BFlagId { get; set; } // BFlagID
Marked as answer by TPeczek on 11/27/2013 at 2:36 AM