这是我从官网复下来的一个例子,当我在组件的外部点击按钮时就替换组件中name为available的store,并将store中的值进行显示,
自己试了很久就是无法进行替换,只能显示最初赋给它的store的值,请教高手!
    var isForm = new Ext.form.FormPanel({
        title: 'ItemSelector Test',
        width:700,
        bodyStyle: 'padding:10px;',
        renderTo: 'itemselector',
        tbar:["->",add,updateButton],
        items:[roleRadio,comb,{
            xtype: 'itemselector',
            name: 'itemselector',
            fieldLabel: 'ItemSelector',
        imagePath: '/lsal/ext/examples/ux/images/',
            multiselects: [{
                name:"available",
                width: 250,
                height: 200,
                store: store,
                displayField: 'name',
                valueField: 'id'
            },{
                width: 250,
                height: 200,
                store: testStore,
                displayField: 'name',
                valueField: 'id',
                tbar:[{
                    text: 'clear',
                    handler:function(){
                    isForm.getForm().findField('itemselector').reset();
                }
                }]
            }]
        }],
    });

解决方案 »

  1.   

    multiselects是什么组件?即它的xtype?
    记得grid有setStore()方法,或许你可以给它加个类似的方法
      

  2.   

    不需要替换store吧?直接更改store请求的位置不就是想要的效果?只要你返回的json的格式一样就可以
    store.proxy=new Ext.data.HttpProxy({
     url:'test.do?id='+id}); 
     store.reload();  //重新加载room的store
    }
    在你按钮点击的时候,重新设置HttpProxy