Rick Weller
Rick Weller

Reputation: 1258

dynamic url for store is not working with paging toolbar

I have a grid where people based on some selection will see data. To load the data in the grid i use this

Details.load({
url: baseUrl + 'data/'+data.Id+'/info.json?page=1&fromDate=' + startDate + 'T' + startTime + '&toDate=' + endDate + 'T' + endTime
});

This will load the store. But now is there a problem. I have a paging toolbar

bbar: Ext.create('Ext.PagingToolbar', {
        store: Details,
        displayInfo: true,
        displayMsg: 'Displaying record {0} - {1} of {2}',
        emptyMsg: "No records to display",

    })

And now when the grid is loaded with the store the paging toolbar shows the pages correct. But when i click on next it will not load the same url. It will load the url defined in the store. So i did try the store without a url but then there is an error:

TypeError: p is undefined

So what do i need to do to get the pagingToolbar using the correct url?

Upvotes: 3

Views: 1054

Answers (1)

Ian
Ian

Reputation: 336

You can change the url for the store through its Proxy. Try adding a listener on the store beforeload which should fire before the request is made

listeners:{
    //this is used to construct the proxy url before the load is done
    beforeload:{

        fn:function () {
            var me = this;
            me.updateProxyURL(); //write this function yourself
        }
    }

Upvotes: 2

Related Questions