extjsstoreextjs6.5

Store not reloading in ExtJs


I am working on a display where I need to bind a combobox but its not reloading with latest data. There is only one call to database and after that its using existing store from cache. How to make it reload from database every-time(or at least every-time when we reopen the display). Below is the code.

//store
Ext.define('NetworkStore', {
    extend: 'Ext.data.Store',
    alias: 'NetworkStore',
    fields: ['Id', 'value'],
    storeId: 'NetworkStore', 
    autoLoad: true,
    proxy: {
        type: 'ajax',
        useDefaultXhrHeader: false,
        actionMethods: { create: "POST", read: "GET", update: "POST", destroy: "POST" },
        headers: { 'Content-Type': 'application/x-www-form-urlencode' },
        limitParam: false,
        startParam: false,
        pageParam: false,
        extraParams: {
            Style: 1
        },
        url: 'url',
        reader: {
            type: 'json'
        }
    }
});

xtype: 'combo',
name: 'NetworkIDList',
store: Ext.create('NetworkStore').load({
                    params: {
                        Style: 3
                    }
                }),

Solution

  • If we pass store as given below it will always get store from db not from cache.

      store: {
                type: 'NetworkStore',
                proxy: {
                        extraParams: {
                            Style: 3
                        }
                    }
                }