My jqGrid work dynamically.So that all options are loaded dynamically too.
This options are generated with java Map<String,Object>
All options work very well, but the function name within de map/opts not work.
This is json map generated with java.
"colModel":[...{"formatter":"myFunction","index":"","name":""}]
I did not debug the jqgrid.src.js yet and i think that the problem are with the eval.
the “myFunction” is not called and the undefined is returned.
The
formatteroption can be a string if it is one of the predefined formatters, but according to the jqGrid docs for custom formatters:So jqGrid expects a function to be passed. This is why
myFunctionworks but"myFunction"does not. Anyway, to solve your problem you need to output the code:To go a bit deeper, you can see in the jqGrid source file grid.base.js that the formatter uses a function directly, but if a string is passed that string is passed to
$.fn.fmatter:If that function is not already present in jquery.fmatter.js then I would expect an error to occur when the grid attempts to use it.