PDA

View Full Version : Same grid with different stores



jorgeluislay
9 Oct 2012, 2:07 AM
Hi!

I have a grid with a store. On top of the grid i have some tbar buttons, where i would like to define other stores but for the same grid (same reader, same filds, but different url).

How is the best way to solve this ? :-/

willigogs
9 Oct 2012, 3:39 AM
Change the url of your store on the button click using the setUrl method:
http://docs.sencha.com/ext-js/3-4/#!/api/Ext.data.HttpProxy-method-setUrl

jorgeluislay
9 Oct 2012, 8:18 AM
you mean like this:


me.getStore().setUrl("admin/newaddress/whatever.req"(false);
me.getStore().reload();


??

willigogs
9 Oct 2012, 9:29 AM
store.proxy.setUrl('new url goes here');

jorgeluislay
10 Oct 2012, 12:53 AM
Thank you. It works fine.

I was trying to do some kind of setStore and after i change the url by setting this as a globel variable didnt really work and now i know, it was becouse of the proxy which is set to permanent and does not reconize the new url by doing a grid.getStore.load(new params and an other url).