javascript - easyUI datagrid inner edit combobox cannot selected default value -


easyui datagrid inner editor load combobox cannot selected default value

jsfiddle link

{field: "xx", title: "xx", width: 200, editor: { type: "combobox", options: {     valuefield: "xx",     data: [         {"xx": 1, text: "aaa", selected: true},         {"xx": 2, text: "bbb"},         {"xx": 3, text: "ccc"}     ],     onloadsuccess: function(rows) {         for(var i=0; i<rows.length; i++) {             if(rows[i].selected) {                 $(this).combobox("setvalue", rows[i].xx);                 return;             }         }     } } 

you can try change line

for(var i=0; i<rows.length; i++) { 

to one

for(var i=0; i<data.length; i++) { 

it's tested , working.

or can

onloadsuccess: function(rows) {        $(this).combobox("setvalue",rows[-1].xx);   } 

this select first value


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -