listeners:{
         load: function(sto, records){
         sto.each(function(record){
         if(record.data.value !=""){
         var arr_value=record.data.value.split(",");         if(arr_value.length>1){
         record.data.editor= new Ext.grid.GridEditor(new Ext.form.ComboBox({
                         store: new Ext.data.ArrayStore({
                             fields: ['name'],
                             data: [arr_value]                         }),
                         typeAhead: true,
                         displayField: 'name',
                         selectOnFocus: true,
                         triggerAction: 'all',
                         mode: 'local'
                     }));
         }
         }
         });
            }
        }  
record.data.value的值是aaa,bb;但生成的下拉框选项中只有aaa,如果fields: ['code','name']那么下拉选框中只有bb,求解~~~
extjs 下拉框Ext JS

解决方案 »

  1.   

    try: new Ext.form.ComboBox({
    store: new Ext.data.ArrayStore({
    fields: ['name'],
    data: [['aaa'],['bb']]
    }),
    typeAhead: true,
    displayField: 'name',
    selectOnFocus: true,
    triggerAction: 'all',
    mode: 'local'
    })
      

  2.   

    这样是可以的,但是data值每次都不一样,不能写死。
      

  3.   

    "aaa,bb".split(',')的数组是
    ['aaa','bb']这是一维数组
    ext期望的是二维数组
    [['aaa'],['bb']]
      

  4.   

    返回字符串写成json格式,不要自己解析。就能自动加载上去的。按照model,store,combo的顺序写,想出错都难。
      

  5.   

    listeners:{
             load: function(sto, records){
             sto.each(function(record){
             if(record.data.value !=""){
             var arr_value=record.data.value.split(",");
             var json_value=new Array();
             for(var i=0;i<arr_value.length;i++){
             json_value[i]=new Array();
             json_value[i][0] = arr_value[i];
             }
             if(arr_value.length>1){
             record.data.editor= new Ext.grid.GridEditor(new Ext.form.ComboBox({
                             store: new Ext.data.SimpleStore({
                              fields: ['name'],
                                 data: json_value
                             }),
                             typeAhead: true,
                             displayField: 'name',
                             selectOnFocus: true,
                             triggerAction: 'all',
                             mode: 'local'
                         }));
             }
             }
             });
                }
            }  
    这样写,创建一个二维数组就正确了~~ 谢谢提示~~\(^o^)/~