I don't know if this is directly related to the problem, but my strategy for formatting stuff in jqgrid is usually to render it directly in PHP the way I want it and to add an “index” column with the unformatted value that is used for sorting afterwards. F.x.: