ExtJS 4.0自带的插件itemselector的store,值如何动态改变啊?

[code="java"] items: [{
fieldLabel: 'keyword',
listeners:{
change: function(textfield, value){//我的意图是,这个值变的时候,在下面列表里刷新product_store,达到筛选的目的,但store是刷新了,但itemselector左边框框里没有变过来
product_store.load({
params: {
query: "37"
}
});
}
}
},{
fieldLabel: 'product list',
name: 'products_ids',
id: 'products_ids',
xtype: 'itemselector',
allowBlank: false,
store: product_store,
displayField: 'model',
valueField: 'id',
hideNavIcons: true,
msgTarget: 'side'
}], [/code]

程序开始的时候用autoLoad可以让itemselector左边框框里有初始值:
[code="java"]var product_store = Ext.create('Ext.data.Store', {
model: 'Product',
storeId: 'AllProduct',
autoLoad: {
params: {
query: "670"
}
}
}); [/code]

5个回答

:P 贴个图吧?然后描述下啊

8) 哦 明白了 你的意思,available的数据,根据关键字动态改变?
解决了??

我也遇到了这个问题,已经解决了!修改了一些itemSelector.js的代码:

在 53 行 注释掉 me.bindStore(me.store);
[code="java"]
initComponent: function() {
var me = this;

    me.ddGroup = me.id + '-dd';
    me.callParent();

    // bindStore must be called after the fromField has been created because
    // it copies records from our configured Store into the fromField's Store
   // me.bindStore(me.store);
}

[/code]

将56行修改成
[code="java"]
createList: function(title, isStore){
var me = this;

    if(isStore) {
        store = me.store;
    } else {
        store = {
           model: me.store.model,
           data: []
        };
    }

    return Ext.create('Ext.ux.form.MultiSelect', {
        submitValue: false,
        flex: 1,
        dragGroup: me.ddGroup,
        dropGroup: me.ddGroup,
        title: title,
        store: store,
        displayField: me.displayField,
        disabled: me.disabled,
        listeners: {
            boundList: {
                scope: me,
                itemdblclick: me.onItemDblClick,
                drop: me.syncValue
            }
        }
    });
},

[/code]

将 87 行代码修改成
[code="java"]
setupItems: function() {
var me = this;

    me.fromField = me.createList(me.fromTitle, true);
    me.toField = me.createList(me.toTitle, false);
    ....

})
[/code]

之后外面直接

itemSeletor.store.load()就ok了!

用 bindStore方法添加store

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!