Gregory Nozik
Gregory Nozik

Reputation: 3372

Paging store does not changed

I am using Reconfigure function to change the columns and data of the panel form.

See below the code that I wrote

    var newStore = Ext.create('Ext.data.Store', {
        fields: tmpFields,
        pageSize: itemsPerPage,
        proxy: {
            type: 'ajax',
            url: getDataWithPageURL,

        }
    });


     globalStore = newStore.load({
        params: {
            start: 0,
            limit: itemsPerPage
        }
    });

   grid.reconfigure(globalStore, tmpColumns);

The code is working,and the data is changed. But paging and total does show old data.

Please help .

Upvotes: 0

Views: 1754

Answers (2)

Lionel Chan
Lionel Chan

Reputation: 8079

In ExtJS, PagingToolbar is working closely with a given Store, and this is the reason why there is no event listener hooked onto the reconfigure because reconfigure is defined in Ext.panel.Table.

Hence, another solution is by rebinding the store when reconfigure has been fired, that is:

Ext.define('NS.toolbar.Paging', {
    extend: 'Ext.toolbar.Paging',
    initComponent: function() {
        var me = this;
        me.callParent();
        me.on('afterrender', function() {
            me.ownerCt.on('reconfigure', function() {
                me.bindStore(me.ownerCt.store || 'ext-empty-store', true);
            });
        });
    }
});

Read it as, after the PagingToolbar has been rendered, we bind a function to the event reconfigure so that whenever a reconfigure happens, you rebind the store in paging toolbar.

Tested and it works. Try it out here at jsfiddle

Cheers

Upvotes: 1

Gregory Nozik
Gregory Nozik

Reputation: 3372

I think that it's bug in the reconfigure function .

So I created pagging bar and added again . See code below

    var PagingBar = Ext.create('Ext.PagingToolbar', {
        pageSize: itemsPerPage,
        store: globalStore,
        dock: 'bottom',
        displayInfo: true
    });

    grid.removeDocked(grid.getDockedItems()[1]);

    grid.addDocked(PagingBar);

Upvotes: 0

Related Questions