PDA

View Full Version : store.find in my buffered grid only finds results on the 1st page



Mulvihic
9 Dec 2013, 9:29 AM
Hi,
I have a grid and I'm using store.find on my store which has paging enabled (I'm using the buffered renderer).
store.find only finds matching items on the 1st page in my store.

Is there a way to get around this?

Can I force load the next page?

tobiu
9 Dec 2013, 11:46 AM
store.find only works locally as pointed out in the docs:
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store-method-find


**IMPORTANT

If this store is buffered, this can ONLY find records which happen to be cached in the page cache. This will be parts of the dataset around the currently visible zone, or recently visited zones if the pages have not yet been purged from the cache.**


if you want to show the records you find, you can take a look at the config "remoteFilter" and use filter() instead.

you can also use an ajax call to your backend to check if the record exists there.

to load the next page, use:
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store-method-nextPage

Mulvihic
9 Dec 2013, 2:58 PM
Thanks Tobiu,I checked the backend and confirmed the record exists- but I don't think this gives me the index to jump to- I am new to extjs so there is a good chance I'm missing something that is kinda obvious!

I was thinking that once I confirmed it exists I could use loop though the pages using find.store until I get a match?
This seems like a hack so I hope there is a prettier way of scrolling to the matched index for a buffered grid.

evant
9 Dec 2013, 3:10 PM
Buffered stores are intended for when you have a dataset that's too large to reasonably fit in memory. What that number is depends on a few things, but you may not need it.

Buffered rendering can be used without a buffered store, they don't necessarily need to be used together.

Mulvihic
9 Dec 2013, 3:15 PM
my dataset is kinda big- around 1million rows. what would it mean to use buffered rendering without buffered store?

evant
9 Dec 2013, 3:16 PM
Ok, that's pretty big then! Keep going as you are.