本帖最后由 toss2000 于 2011-03-30 09:20:38 编辑

解决方案 »

  1.   

    我给你个例子看看吧 var user_dataProxy = new Ext.data.HttpProxy({
            url: '__URL__/usershow',
            method: 'POST'
        });  var user_dataReader = new Ext.data.JsonReader({
       root: 'root',
       id: 'id',
       fields:['id','name']
       }); var user_store = new Ext.data.Store({  
        proxy: user_dataProxy,
        reader: user_dataReader,
        autoLoad: true });
       var combouser =new Ext.form.ComboBox({
             xtype:"combo",
          fieldLabel: 'Author',
          name: 'authorlist',
    store:user_store,
               
                  displayField:'name',        
                  valueField: 'id',        
                  mode: 'remote',
                  editable:false,
                  width:200,
          triggerAction: 'all',       
          emptyText:'Select an user',
          //readOnly: true, 
          hiddenName: 'author' 
         });
      

  2.   

    你的逻辑有问题吧你在load的时候 数据请求还没返回呢你就去取数据~~你可以在其他时候取值 例如在整个页面加载的最下面 写一个方法在里面获取到上面combox的值
      

  3.   

    自己搞定了,代码如下,希望对需要的兄弟们有所帮助
    var templateStore = new Ext.data.JsonStore({
            url:'../templateManage.do?method=queryAllTemplate',
            root : 'root',
            autoLoad:true,
    fields:[{
    name : 'reportId',
    type : 'int'
    },{name:'name',type:'string'}]});

    templateStore.on('load',function()
     {
       combo.setValue(templateStore.getAt(0).get("reportId"));
       historyStore.baseParams.conditions =combo.getValue();//注意只能在这个地方获得combo.getValue()的值,其他地方获得不了这个值,historyStore也是一个数据集,需要首先获得combo.getValue()的值作为参数进行加载
       historyStore.load();
    });
    先晒晒,之后揭帖