SmartClient Version: v10.0p_2015-06-23/Pro Deployment (built 2015-06-23)
I have a modal window with a button at the bottom that, when pushed, shows a listgrid and starts editing a new row.
The problem is that when the listgrid is shown, the layout scrolls to the top (I believe this is caused by the redraw when the layout is re-sized by the listgrid appearing) and the focused cell in the listgrid is shown outside of the modal window (see attached screenshot)
Test case:
I have tried adding vLayout.scrollToBottom() in the listgrid drawhandler but it doesn't do anything.
Is there a way I can get the layout to scroll down to the listgrid when I start editing a new row?
I have a modal window with a button at the bottom that, when pushed, shows a listgrid and starts editing a new row.
The problem is that when the listgrid is shown, the layout scrolls to the top (I believe this is caused by the redraw when the layout is re-sized by the listgrid appearing) and the focused cell in the listgrid is shown outside of the modal window (see attached screenshot)
Test case:
Code:
Window modal = new Window();
modal.setHeight(300);
modal.setWidth(300);
modal.setIsModal(true);
modal.setShowModalMask(true);
modal.centerInPage();
final VLayout vLayout = new VLayout();
vLayout.setWidth100();
vLayout.setOverflow(Overflow.AUTO);
vLayout.setMinMemberSize(250);
LayoutSpacer spacer = new LayoutSpacer();
spacer.setHeight(200);
DataSourceTextField dsField = new DataSourceTextField("text");
dsField.setType(FieldType.TEXT);
dsField.setLength(1000);
DataSource ds = new DataSource("ds");
ds.setClientOnly(true);
ds.setFields(dsField);
ListGridField field = new ListGridField("text");
final ListGrid listGrid = new ListGrid();
listGrid.setWidth100();
listGrid.setDataSource(ds);
listGrid.setFields(field);
listGrid.hide();
Button b = new Button("Press Me");
b.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
if(!listGrid.isVisible())
{
listGrid.addDrawHandler(new DrawHandler() {
@Override
public void onDraw(DrawEvent event) {
vLayout.scrollToBottom();
listGrid.startEditingNew();
}
});
listGrid.show();
}
else
listGrid.startEditingNew();
}
});
vLayout.setMembers(spacer, b, listGrid);
modal.addItem(vLayout);
modal.draw();
Is there a way I can get the layout to scroll down to the listgrid when I start editing a new row?
Comment