View Full Version : how to refresh the grid, not render it again.

30 Mar 2007, 10:26 PM

I'm creating a grid which is stored in a global object.

The grid is rendered in a div inside a tab panel.

after changing from tab to tab, and coming back again to the grid, I need to mouseover it in order to turn it visible again.

I wonder if there's a way like

is useless to call myGrid.render();

Because everything is already in memory.

Any Idea ?

31 Mar 2007, 3:03 PM
Data.Store.reload() ??

31 Mar 2007, 3:17 PM
use grid.getView().refresh()

does a redraw. I find that if I change the column model, i need to use getView().render

do not use grid.render() more than once, as it will install duplicate handlers.

31 Mar 2007, 3:24 PM
getView().refresh() almost worked. The problem is that the header is not shown.

3 Apr 2007, 12:55 PM
I had the same problem, and on top of that, everytime i clicked an editable cell in any of my grids, the focus wouldn't hold. The following fixed both.

(At the top your custom js file, before Ext.onReady or anything like that)

Ext.grid.RefreshingEditorGrid = function(container,config){
this.rendered = false;
/* grid.render is the first instance that grid.getView() is
called, and it sets grid.view to the returned variable.
Thus, call grid.render() if it hasn't been.
if(!this.view) this.render();
else this.getView().refresh();
That way you can instantiate with something like:

grid = Ext.grid.RefreshingEditorGrid('grid-id',config);
And later call:

Just make sure you explicitly call

To clear the air, layout is the layout containing your ContentPanel, panel is the content panel containing your grid, panelId is the id of the div used to add to the layout, and grid is the EditorGrid in question.

And Jack, should you read this, I think it'd be an easy thing to bend a bit into being part of Ext.grid.Grid on the next rev :)