开发者

How to display different values in a jqGrid column

开发者 https://www.devze.com 2022-12-21 11:10 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号