We are in the process of developing a major web application to bring our ERP system to web. In this process we have encountered a problem that is very vital for us. And to us it seems like a bug.
If a grid is being shown and the user scrolls down in the grid and selects a row, this context is being lost, when another window is shown (hiding the grid) and afterwards returning to the grid.
I’ve attached an example UI. The UI shows two tabs with a grid in the first tab. If you scroll down and select eg. row 150, click on the other tab and click on the first tab again, the grid is now positioned at the top and not staying where the grid was previously scrolled to. If you scroll down you can see that the row is still selected - so only the scrolling is being lost.
Does anyone have a suggestion to what we can do? This is quite a “show stopper” for us… So hopefully someone has a solution.
Regards,
Brian
@SuppressWarnings("serial")
public class GridTestUI extends UI {
@SuppressWarnings("unchecked")
@Override
protected void init(VaadinRequest vaadinRequest) {
TabSheet tabSheet = new TabSheet();
tabSheet.setSizeFull();
Grid grid = new Grid();
grid.setSizeFull();
IndexedContainer container = new IndexedContainer();
container.addContainerProperty("Column", String.class, "");
for (int i = 0; i < 200; i++) {
Item item = container.addItem(i);
item.getItemProperty("Column").setValue(String.valueOf(i));
}
grid.setContainerDataSource(container);
tabSheet.addTab(grid, "Grid");
tabSheet.addTab(new TextField("Text field"), "Text field");
setContent(tabSheet);
}
static public GridTestUI getCurrent() {
return (GridTestUI) UI.getCurrent();
}
/**
* Defines VaadinServlet config
*/
@WebServlet(value = { "/gridtest/*" }, name = "GridTestUIServlet", asyncSupported = true)
@VaadinServletConfiguration(ui = GridTestUI.class, productionMode = false)
public static class Aspect4UIServlet extends VaadinServlet {
}
}