frosty
frosty

Reputation: 5370

Using a single store on multiple grids and dropdowns with extjs 4.1

I have a store "Contacts". In my application i'm using this in 2 grids and 1 combo box. In Each of these components have varying screen space so i need to define pageSize. What is the best practise for this scenario. Is it better do create 3 different stores. ( I'm using MVC ) . If so, are there naming conventions.

Edit

Currently i load the stores in the onLaunch method in my controller

 var partsStore = this.getPartsStore();
        partsStore.pageSize = 15;
        partsStore.load({
            scope: this
        });

and reference this store in my view

Ext.define('Mis.view.JobPartList', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.jobpartlist',
    store: 'Parts',

Upvotes: 1

Views: 957

Answers (1)

Evan Trimboli
Evan Trimboli

Reputation: 30082

Yes, you should create multiple store instances. Not sure what you mean about naming conventions, the store name should stay the same whether you have 1 or multiple instances.

Based on the code you've posted above, it's not going to work, because by adding it to the class definition you're telling it to explicitly share the store.

Ext.define('Foo', {
    // ...
    initComponent: function(){
        this.store = new MyStoreType();
        // ...
        this.callParent();
    }
});

Upvotes: 1

Related Questions