I’m using jqgrid for which I create column definitions on server as dynamic objects and serialize them using Json.Encode:
html.Raw(System.Web.Helpers.Json.Encode(ColumnDefinition);
I have problem with applying custom formatter, as my serialized column definition is:
{"name":"Icon","index":"Icon","hidden":false,"formatter":"iconFormatter","unformat":{}}
Problem is in quotes which are added to all keys and values to respect JSON specification, and those around iconFormatter are problem in my case as I want that to be my function.
Is there a simple solution for this?
It seems to me that you have the same or close problem as described here. You will have to replace the string values of the
formatterproperties to the function reference. Pragmatic way is to search for the strings like"iconFormatter"(search for all custom formatters which you use) and replace there to the corresponding function refernce.UPDATED: If you would be use
templateproperty inside of column definition (see here) you would be solve the problem in another way. Additionally you code will be shorter, more clear and better readable.