changed the condition when the grid is shown