ext 级联菜单

来源:互联网 发布:sql like in 编辑:程序博客网 时间:2024/05/16 12:28

 var modelStore =  new Ext.data.JsonStore({
   url:'<%=path%>/servlet/common?action=getModel',
      fields : ['modelid', 'model_name']
     
  });
    modelStore.load();
 var modelbox = new Ext.form.ComboBox({  
        fieldLabel : '选择(输入)模板',
       
        hiddenName : 'model_name',
        store :modelStore,  
        valueField : 'model_name',  
        displayField : 'model_name',  
        typeAhead : true,  
        mode : 'local',  
        triggerAction : 'all',  
        allowBlank:false,  
        blankText : '请选择或者输入模板',  
        emptyText : '选择或者输入模板',
        editable: true,
        selectOnFocus : true,  
        width : 190

     });
     var orgStore =  new Ext.data.JsonStore({
   url:'<%=path%>/servlet/common?action=getajtype',
      fields : ['ajtypeid', 'classname']
     
  });
  orgStore.load();
 var orgbox = new Ext.form.ComboBox({  
        fieldLabel : '选择案件类型',
       
        hiddenName : 'ajtypeid',
        store :orgStore,  
        valueField : 'ajtypeid',  
        displayField : 'classname',  
        typeAhead : true,  
        mode : 'local',  
        triggerAction : 'all',  
        allowBlank:false,  
        blankText : '请选择案件类型',  
        emptyText : '选择案件类型',
        editable: true,
        selectOnFocus : true,  
        width : 190,
        listeners:{
         "select":function(orgbox,record,index){
           var codeId = orgbox.getValue();
           //modelStore.load({params:{code:codeId}});
           modelStore.proxy=new Ext.data.HttpProxy({url:'<%=path%>/servlet/common?action=getModel&code='+codeId});
           modelStore.load();
           Ext.getCmp(modelbox.id).setValue('');
          } 
        }

     });