PDA

View Full Version : [4.0.2a] Trouble refreshing a buffered store



slemmon
12 Aug 2011, 12:26 PM
[Ext JS 4.0.2a]
I have a grid + store with buffered: true and pageSize: 50. I load the store using store.guaranteeRange(0, 49).
That works to pre-load 1k records into my store, but only display 50 rendered grid rows at a time.

I then want to refresh the grid. I'm hoping to flush the records in the store/grid and reload from the sever.

If I use store.load() it loads the store from the server with 1k records, but also renders 1k grid rows.
If I use store.prefetch() the store is loaded with 1k records, but nothing changes in the grid.

What is the best way to reload the store while maintaining the buffered grid view?

slemmon
13 Aug 2011, 1:32 PM
I've tried setting the proxy's params and then using the guaranteeRange again, but it looks like since the prefetching has been done already that the guaranteeRange method doesn't do much. No second trip to the server. Thus, no refreshing of the grid's view.

Probably there's a very straight-forward answer to this one, but it's escaped me thus far. Thoughts?

mitchellsimoens
13 Aug 2011, 6:31 PM
Isn't the idea of using a buffered store is that you buffer all and the Grid will only render so many? 50 may be a little to low also

slemmon
13 Aug 2011, 7:06 PM
So, the application is that I've got an OpenLayers map and a database of 650k customer records all geocoded. The user can zoom with the map down to a location they want records for and fetch the customer data for that geographic area. That way they can see spend data per product / customer classification and it lets them see norms per region (I cut off the fetch at 1k records just to set a ceiling).

I need to allow them to zoom into Phoenix metro and get the pricing norms. Then they should be able to center into Santa Fe metro and see the customer population there. Each zoom/fetch would re-populate the store with then new customer data set defined by that lat/long boundaries of the given map.

So, while I grab 1k worth of records to get pricing norms, allow for filtering by product/sales rep/business name/etc. to get aggregate data and allow for user defined filtering I don't want to bloat the DOM with unnecessarily rendered rows since the gridpanel is only about 30 rows high at a given time.

I could increase from 50, but when I tested it (without refreshing the store) it was working splendidly so I left it at 50.

Don't know if that helps to give some context. Also, I'm certainly open to some other solution. Just thought the buffered view was the most elegant implementation after seeing how well it handled 5k records in the examples.

slemmon
13 Aug 2011, 7:07 PM
Thx for looking into this with me, BTW. I really appreciate it. I've really been struggling trying to figure this one out.

stevil
17 Aug 2011, 11:41 AM
Isn't the idea of using a buffered store is that you buffer all and the Grid will only render so many? 50 may be a little to low also

Didn't Ed say that you were revisiting the store load semantics for buffered grids in 4.1, or some time around there? I remember him saying that you shouldn't have to have a separate means of loading a grid when buffered, as opposed to non-buffered...

stevil

slemmon
17 Aug 2011, 12:10 PM
I like the way Ed thinks on this one. :D

The buffered view seems like a real DOM saver to me, but I'm stuck when the store content is dynamic per user interaction.

Thank you both for checking on this!

mitchellsimoens
17 Aug 2011, 12:50 PM
Didn't Ed say that you were revisiting the store load semantics for buffered grids in 4.1, or some time around there? I remember him saying that you shouldn't have to have a separate means of loading a grid when buffered, as opposed to non-buffered...

stevil

4.1.0 will have so many grid enhancements

slemmon
17 Aug 2011, 12:54 PM
Ok. Cool. I'll hold my horses and see what drops with 4.1.
Thx to you both for the answers. I'll consider this one "ANSWERED". :)