开发者

jqgrid, setting value of an editable select control

开发者 https://www.devze.com 2023-03-21 05:50 出处:网络
I have an editable grid, with one of its column is a SELECT type, e.g. colModel:[{ name:\'myText\',index:\'myTextColumn\',editable: true, edittype: \'text\'},

I have an editable grid, with one of its column is a SELECT type, e.g.

colModel:[{ name:'myText',index:'myTextColumn',editable: true, edittype: 'text'},   
          {name:'myList',index:'myList', width:editable: true,edittype: "select",
            editopti开发者_StackOverflowons: { value: {'v1':'Value 1','v2':'Value 2',....} },
          ............    
        ] 

I use the method setRowData to set data in one of the rows by code. The value that I pass for the Select type cell is the option value, e.g.

jQuery("#myGrid").setRowData( rowId, { myText:"Text 2", myList:"v2", ..... })

After executing this code, the text type cell displays "Text 2", as expected. However, the the Select type cell displays "v2" not "Value 2". Only when I click that cell the display changes to "Value 2"

How can I force the select type cell display the correct value without the need for manual click later?


Meanwhile I found the solution for this problem. Just add a formatter of type "select" to the column. http://www.secondpersonplural.ca/jqgriddocs/_2kn0mlo1p.htm

0

精彩评论

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