View Full Version : getGridView().refresh(false) srolls the grid to the top.

1 Apr 2011, 5:30 AM

Is there a way to refresh the grid's view without scrolling to the top of the grid?

I have a grid that has a RowClick listener, when clicked, the first column of the row turns into a rotating progress animation while
an ajax request is being executed.
Once the request finishes I update the row's data.

On both these updates I call mygrid.getView().refresh(false); in order for the changes to be visible.

The problem with this is that if the record is somewhere in the middle of the grid (scroll bar in the middle), then the refresh()
method scrolls the grid to the top.
I tried adding mygrid.getView().focusRow(recordIndex); after both refresh calls, which works good in firefox, but in IE8 it's a bit
laggy and you can see the grid scrolling to the top then back to the selected row.

Is there another way to do this, or is this IE8 just being stupid/slow?

Example pseudo code:

public void ajaxRequest(ModelData record){
//there is a GridCellRenderer that returns new Html("<img.../>") with the loading animation when status column = checking
record.set("status", "checking");
final int recordIndex = getMyGrid().getStore().indexOf(record);
//on 200 response parse json, and update the record values, record.set("status", "checked"); etc. and again call the gridview refresh and focusRow methods.


2 Apr 2011, 12:31 AM
GridView contains :

protected boolean preventScrollToTopOnRefresh;



2 Apr 2011, 1:08 AM
I didn't find a setter method for this and I forgot to check the fields.

Thanks :)