How to display different values in a jqGrid column
I have a jGrid with an editable column some_other_id
that has a select dropdown with keys/values of 1:A,2:B,开发者_高级运维3:C
. I want the selected choice in each row to display the text value of the choice (e.g. 'A', 'B', 'C'), not the ID (1, 2, or 3). It currently displays the ID.
colModel :[
{ label: 'ID', name:'id' },
{
label: 'Some Other ID',
name: 'some_other_id',
editable: true,
align: 'center',
edittype: "select",
editoptions: {value:"1:A,2:B,3:C"}
},
],
How to make it display the selected text value from editoptions
instead?
Just use formatter:'select'
in the column model
Reference: trirand_jqgridwiki_wiki:predefined_formatter
It does not seem like this should matter, but the jqGrid documentation uses the following syntax:
value: {1:'A',2:'B'}
Alternatively, I have used the following syntax in my application:
value: "5:'A';4:'B'"
Give those a try and see if that makes a difference in your application.
精彩评论