首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

Ext.form.ComboBox动态加载数据库数据的有关问题,麻烦各位给看看!

2013-06-19 
Ext.form.ComboBox动态加载数据库数据的问题,麻烦各位给看看!!!Action中的方法:public String listGrade()

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吧。

热点排行