JqGrid using the same info field for multiple columns

I have a jqGrid that gets its data in JSON by setting the url parameter .

Is it possible to create multiple columns and let them display the same JSON response property?

For example, in one column I want to display data formatted in one way, in another column I want to display data in a different way.

+3
source share
1 answer

Yes it is possible. The exact implementation depends on the format you use in the server response. If you use jsonReader: { repeatitems: false }, then colModelyou can use the property jsonmap. jqGrid uses jsonmap instead name while reading the response from the server. Therefore, the solution to your problem may concern the following

colModel: [
    ...
    { name: "mainColumn" },
    ...
    { name: "duplicate1OfMainColumn", jsonmap: "mainColumn" },
    ...
    { name: "duplicate2OfMainColumn", jsonmap: "mainColumn" },
    ...
]

In the case, you can define different formats for each of the columns.

If you need to use datatype: "xml"instead datatype: "json", then jsonmapyou can use instead xmlmap.

+5
source

All Articles