PDA

View Full Version : Scroll into view when using buffered grid



LarssaAndin
14 Mar 2014, 8:47 AM
I've implemented my own version of live search that is supposed to support buffered grids and also column header matches. It works pretty well but it fails on one thing that I need some help figuring out how to solve.

When I search in a grid that is large enough to need a buffer refresh when scrolling (all my grids are buffered using the bufferedrenderer plugin) I have trouble with my step to next/previous code. If the next search hit is located in a grid cell that isn't rendered right now I can't scroll to it automatically.

The method I normally use to get the cell to scroll to is getCellByPosition in tableview, and that works perfectly on already rendered cells but (usually) fail on those who aren't. The reason I say usually is that I sometime seem to be able to access the cells at the first or last row of the grid even though that part isn't rendered at the moment. Not really sure why that is the case.

Example of how I use getCellByPosition (yes, I have locked columns in my grid).


var cell = grid.view.normalView.getCellByPosition({row: 1000, col: 1})


So, my question is, do anyone have a suggestion on how to trigger a scroll (or a buffer update) of the correct records in my scenario so the relevant cells are rendered and I can scroll to the cell?

slemmon
17 Mar 2014, 10:37 PM
There is not a scrollToCell option with the bufferedRenderer, but there is a scrollTo (row) method that may help:
http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.grid.plugin.BufferedRenderer-method-scrollTo

LarssaAndin
18 Mar 2014, 12:04 AM
Thank you! That worked fine :-)