PDA

View Full Version : [SOLVED] PagingBar with a mind of its own...



Nightwish
16 Jul 2010, 12:32 PM
It's either that or I am doing things completely wrong.

I've got a tree and upon clicking a leaf in the tree a grid is refreshed with new data (url is a parameter on the leaf). The grid refreshes just fine but I have not figured out why the PagingBar refuses to sync up with the grid/store.

Once the new data is loaded - anytime I hit a button on the PagingBar the grid reverts back to the original data!!

I suspect there is a better way to load the grid from a new url so that PagingBar is always aware of any changes.

Would someone kindly point me in the right direction?



onDataTreeClick: function(node, e)
{
if (node.isLeaf())
{
e.stopEvent();

// reload the episode grid with the month that was clicked on
var store = Ext.StoreMgr.get('EpisodeStore');
store.proxy.conn.url = node.attributes.href;
store.reload();

// this isn't working - pager still points to the original url of the store
Ext.getCmp('EpisodeGridPager').bindStore(store, true);
}
}

Nightwish
16 Jul 2010, 8:15 PM
Well, that's embarrassing - the solution is actually in the API documentation. The setUrl function on the proxy can be used to change the url permanently.



onDataTreeClick: function(node, e)
{
if (node.isLeaf())
{
e.stopEvent();

// reload the episode grid with the month that was clicked on
var store = Ext.StoreMgr.get('EpisodeStore');
store.proxy.setUrl(node.attributes.href, true);
store.reload();
}
}