Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 909
Rick Weller Avatar asked Dec 02 '25 02:12

Rick Weller


1 Answers

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
        }
    }
like image 162
Ian Avatar answered Dec 04 '25 13:12

Ian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!