ext combobox Store 动态获取值

ext 部分:
// 从后台加载籍贯信息,动态加载 显示到ComboBox中 
第一个方法

//将数据加载到本地
第2个方法 (推荐 方便)
var nativeStore =new Ext.data.JsonStore({

   url:'exam/ExamCourseAction',
    root:'courseName',
   fields:[{name:'course'}]
    
});
第3个方法
 

//comboBox 

{                              
                                                 xtype :'combo',
                                                 fieldLabel :'科目',
                                                 name :'tType',
                                                 hiddenName :'course',
                                                 anchor :'95%',
                                                 editable :false,
                                                triggerAction : 'all',
                                                 store :nativeStore,
                                                //mode:'local',
//用第一个或第二个方法的时候要加mode:'local'用第二个方法的时候不要加 或者改成mode:'remote'
                                                 emptyText :'请选择',
                                                 displayField: 'course',
                                                 valueField :'course'
                                              }




action 部分:

       
          
              course 
          

       

    

java代码部分 :
 package org.action;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class ExamCourseAction {

    privateMap course=  new HashMap();
   
    publicString execute(){
      
      Map map1 = newHashMap();
      map1.put("course", "java");
      Map map2 = newHashMap();
      map2.put("course", "c");
      Map map3 = newHashMap();
      map3.put("course", "vb");
      
      List  ls =new ArrayList();
      ls.add(map1);
      ls.add(map3);
      ls.add(map2);
      
      this.course.put("courseName", ls);
      
      System.out.println("ssssssssss");
       return"success";   
    }

    publicMap getCourse(){
       returncourse;
    }

    public voidsetCourse(Map course){
       this.course= course;
    }
}

你可能感兴趣的:(ext combobox Store 动态获取值)