日期:2014-05-16  浏览次数:20762 次

Ext.form.ComboBox动态加载数据库数据的问题,麻烦各位给看看!!!
Action中的方法:
public String listGrade(){
findGrade = fm.listGrade();
total = findGrade.size();
return SUCCESS ;
}
findGrade为一个List。包含'depid'、'depid'两个属性
json传参
var s_grade =  new Ext.data.JsonStore({  
                  url:'findgrade!listGrade.action',//对应 ACTION 或者SERVLET URL 
                  fields:['depid', 'depid']        
}); 
 var combo=new Ext.form.ComboBox({  
            id:'depart',  
            name:'Pptype',  
            fieldLabel:'年级',  
            emptyText:'请选择',   
            anchor:'95%',  
            mode : 'local',   
            editable: false,  
            triggerAction: 'all',  
             //readOnly : true,    
              store:s_grade,  
              mode : 'remote', //默认远程数据加载 
                  valueField : 'depid',  //值  
                  displayField : 'depname'   //显示下拉框内容                    
           });  

选择框无法加载数据库中的数据
Extjs jsonStore ssh

------解决方案--------------------
前台能获取到数据吗?如果能,这个问题很好解决的。关键看你获取的数据格式。
------解决方案--------------------
楼主要远程加载数据,至少要把combobox的mode设置为remote吧。