PDA

View Full Version : 2 instances of LiveSearchGridPanel, need 2 different instances of store class



mlmarius
1 Mar 2012, 2:07 AM
Hi, i am trying to use 2 instances of a widget that extends LiveSearchGridPanel. The widget defines a store and i create them with Ext.create() when needed. Problem is that filtering one of the widgets allso filters the other so i guess they must have the same store. How do i make them have different instances of the store ? This is my widget code:


Ext.define('AM.view.security.SecurityUserList',{
extend: 'AM.ux_mods.LiveSearchGridPanel',
alias: 'widget.security-user-list-ro',
title: 'Useri',
columns: [
{header: 'User', dataIndex: 'username', flex: 1},
{header: 'Nume', dataIndex: 'first_name', flex: 1},
{header: 'Prenume', dataIndex: 'last_name', flex: 1},
],
store: 'security.SecurityUserStore',

constructor: function(config) {
var me = this;

// Daca trebuie introducem modelul checkbox aici
if(config.withCheckBoxState){
config = Ext.apply(config,{
selModel: Ext.create('AM.ux_mods.selection.CheckboxModel',{
header: false,
checkOnly: true
})
});
}

me.callParent([config]);
},


initComponent: function(){
console.log('init user list ...');
this.callParent();
console.log(this.store);
},

reloadStore: function(loadParameters){
this.getStore().load(loadParameters);
}
});

tobiu
1 Mar 2012, 4:49 AM
remove the line:


store: 'security.SecurityUserStore',


instead, go into the initComponent and write something like:


this.store = Ext.create('FullNamespace.security.SecurityUserStore');