jqgrid display static column that not in json
Is there any way to display a static column value ( ex - "ClickHere" will display in the all rows with the "Details" as column header开发者_运维技巧) in Jqgrid
? i am using spring MVC
Jackson
support for populate the jqgrid
by using a jsonReader
. i just need to have a static string as a column that not comes with the JSON
.
Ex -
Student Name
| Detail
|
XXXX | clickhere
YYYY | clickhere
I need to have 'clickHere' string hardcoded in a jqgrid column while i used studentName from the json object. Can this is doable?
Please let me know your thoughts. Thank you in advance
I don't use spring MVC myself, but to create a column with the static text 'Click here' you can define it with respect of the custom formatter:
{ name:'Details', width:60, sortable:false, search:false,
formatter:function(){
return 'Click here';
},
unformatter:function(){return '';}
}
The definition of the unformatter
is optional. Probably you will not need it. It's depend on how you read (it you ever do it) the data from grid.
It can be that formatter:'showlink' of some other form of link is what you really want to do. In the case you can find the answer on your question here (see the demo).
{ name:function(){return 'Click here';},
width:60, sortable:false, search:false,
formatter:'showlink', formatoptions: { baseLinkUrl: 'javascript:', showAction: "somefunction('", addParam: "');"}
}
By using this way u can use all other option as well like formatoptions
精彩评论