Please see the attached gif, I have a page with an add button and a delete button, they are used to add a row to page or delete a row.
After user click add or delete, I don’t want the page “jump” after user add or click.
My source code is like below:
Component ans = copyTmpObject(component, exampleRow, editGrid, componentsFactory);
int max = 0;
for (Component com : editGrid.getComponents()) {
if (com == null || com.getId() == null) {
continue;
}
if (com.getId().startsWith("livedRow")) {
int x = Integer.valueOf(com.getId().substring(8));
max = x > max ? x : max;
} else if (com.getId().startsWith("lived")) {
int x = Integer.valueOf(com.getId().substring(5));
max = x > max ? x : max;
}
}
if (ans != null) {
ans.setId("livedRow" + String.valueOf(max + 1));
}
editGrid.add(ans);
Hi Daniil,
Sorry for long time no reply, was busy in other things, I did not create the sample project yet. Maybe I can ask in this way:
I have a scrollbox, scrollbox containing a grid, and I am using createComponent to dynamically add new components to a grid while user click a button, I want the new row added to the grid to show in the middle of the web page, how to?
Currently, I try to use requestFocus() method, it does not make the new row to show in middle of the page.