我希望每次点击下拉框的时候,就去后台查一下数据,我想实现这种效果:点击下拉框,取到内容后去后台查询它的子级显示在 textfiled中,这个像省市级联,但是网上的都是Store绑定子级下拉框,而我只想取一个子级,显示在text中。//数据源
  var cstores=new Ext.data.Store({
                       url: '<%=Url.Action("LoadCode", "Organization") %>',
                           reader: new Ext.data.JsonReader({
                               id: 'Id'
                           }, ['Id','OrganizationName','Code']),
                           remoteSort: false
                       });
                       
                     //下级查询数据  5/26 2011 14:30
                    var childStores = new Ext.data.Store({
                       url: '<%=Url.Action("LoadCode", "Organization"  new { Code = Code } ) %>',
                           reader: new Ext.data.JsonReader({
                               id: 'Id'
                           }, ['Id','Code']),
                           remoteSort: false
                       });  var txtP=new Ext.form.ComboBox({
                      
                       fieldLabel: '<font color="red">*</font>上级编号',
                       store: cstores,
                       name: 'CodeStr',
                       hiddenName: 'CodeStr',
                       valueField: 'Code',
                       displayField: 'OrganizationName',
                       typeAhead: true,
                       mode: 'remote',
                       triggerAction: 'all',
                       emptyText: '---请选择上级---',
                       listeners:{       
                           select : function(txtP,newValue,oldValue)  
                           {  
                             childStores.proxy= new Ext.data.HttpProxy({url: '<%=Url.Action("LoadCode", "Organization"  new { Code = '+newValue+' } ) %>'}); 
                             childStores.load(); //加载   
                             
                            
                           }     
                       },  
                       selectOnFocus: true,
                       allowBlank: false,
                       width: 200
                   });

解决方案 »

  1.   

    没人知道吗?问题补充一下:需求是 选择下拉框取值时到后台判断它的子级,显示在 TextField中
      

  2.   

    给store添加load事件,在load事件中设置textfield的值  var childStores = new Ext.data.Store({
      url: '<%=Url.Action("LoadCode", "Organization" new { Code = Code } ) %>',
      reader: new Ext.data.JsonReader({
      id: 'Id'
      }, ['Id','Code']),
      remoteSort: false,
      load:function(store,rcds,opts){//添加load事件,在这个事件中设置textfiled的值就行了。
        if(store.getTotalCount()>0) textfiledExtElement.setValue(rcds[0].get("id"));//注意修改textfiledExtElement为你的变量名称
        else alert('没有数据')
       }
      });
      

  3.   

     消息 1 “get”是一个新的保留字,不应用作标识符 D:\work\trunk\Minstars.FileStorage_src\FileStorage.Web\Views\Organization\Save.aspx 54 82 FileStorage.Web(rcds[0].get("id"));
      

  4.   

    js没有get关键字。。不用理会这种提示