SmartClient Version: v11.1p_2017-08-08/PowerEdition Deployment (built 2017-08-08)
Chrome
I have a larger layout (blue) that houses a smaller ListGrid (green). The grid has a resize bar associated with it. How do I fit the resizeBar to the width of the grid and not the outer container?
i.e.
final VLayout outsideLayout = new VLayout();
outsideLayout.setWidth(200);
outsideLayout.setHeight(200);
outsideLayout.setBorder("3px solid blue");
final ListGrid grid = new ListGrid();
grid.setWidth(100);
grid.setHeight(100);
grid.setBorder("3px solid green");
grid.setShowResizeBar(true);
outsideLayout.addMember(grid);
In general, this scenario looks like this:
One would expect the resizeBar to work something like the following hackery. If I add it, the resize bar starts off sized as desired. However, as I show or hide list grid fields, the resize bar bounces between the width of the grid and the width of the container sporadically and inconsistently. I suspect there is a race condition that needs some overriding as well.
// pathetic hackery
grid.addResizedHandler(new ResizedHandler() {
@Override
public void onResized(ResizedEvent event) {
//Canvas resizeBar = grid.getCanvasAutoChild("resizeBar");
Canvas resizeBar = Canvas.getById(outsideLayout.getID() + "_resizeBar");
if (resizeBar != null){
int newWidth = grid.getBody().getInnerContentWidth();
resizeBar.setWidth(newWidth);
}
}
});
Chrome
I have a larger layout (blue) that houses a smaller ListGrid (green). The grid has a resize bar associated with it. How do I fit the resizeBar to the width of the grid and not the outer container?
i.e.
final VLayout outsideLayout = new VLayout();
outsideLayout.setWidth(200);
outsideLayout.setHeight(200);
outsideLayout.setBorder("3px solid blue");
final ListGrid grid = new ListGrid();
grid.setWidth(100);
grid.setHeight(100);
grid.setBorder("3px solid green");
grid.setShowResizeBar(true);
outsideLayout.addMember(grid);
In general, this scenario looks like this:
One would expect the resizeBar to work something like the following hackery. If I add it, the resize bar starts off sized as desired. However, as I show or hide list grid fields, the resize bar bounces between the width of the grid and the width of the container sporadically and inconsistently. I suspect there is a race condition that needs some overriding as well.
// pathetic hackery
grid.addResizedHandler(new ResizedHandler() {
@Override
public void onResized(ResizedEvent event) {
//Canvas resizeBar = grid.getCanvasAutoChild("resizeBar");
Canvas resizeBar = Canvas.getById(outsideLayout.getID() + "_resizeBar");
if (resizeBar != null){
int newWidth = grid.getBody().getInnerContentWidth();
resizeBar.setWidth(newWidth);
}
}
});
Comment