Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zero Grid Height #53

Open
BarneyIt opened this issue Mar 7, 2018 · 3 comments
Open

Zero Grid Height #53

BarneyIt opened this issue Mar 7, 2018 · 3 comments

Comments

@BarneyIt
Copy link

BarneyIt commented Mar 7, 2018

Hi there,
I'm trying to use a Grid inside a ResponsiveColumn. I think the trouble I meet is about the Grid's Height.
In order to force the Grid Height calculation, I've put the Grid inside a Panel container; but it doesn't work because the Grid doesn't display or better it seems to have a 0px Height.

	grid.setDataProvider(new GridDataProvider());
	grid.addColumn(Row::getCode);
	grid.addColumn(Row::getDescription);
	grid.getColumns().get(0).setCaption("Code");
	grid.getColumns().get(0).setSortable(false);
	grid.getColumns().get(1).setCaption("Description");
	grid.getColumns().get(1).setSortable(false);
	grid.setSizeFull();
	Panel panel = new Panel();
	panel.setSizeFull();
	panel.setContent(grid);
	ResponsiveLayout responsiveLayout = new ResponsiveLayout(ResponsiveLayout.ContainerType.FLUID).withFullSize();
	ResponsiveRow rootResponsiveRow = responsiveLayout.addRow();
	rootResponsiveRow.setSizeFull();
	ResponsiveColumn column = rootResponsiveRow.addColumn().withComponent(panel);
	column.setSizeFull();
    setContent(responsiveLayout);

Diving in the JavaScript at runtime I've found a DIV (yellow circled) having the class v-grid-tablewrapper with height: 0px; furthermore I noticed an upper DIV (blue coloured) having col-container class with only width: 100% attribute and not Height attribute.
After some trials it seems all working good when at runtime I manually add the height: 100% attribute and after a browser resize.
... but I'm not sure this is the right way toward my goal.
Every hint or even a workaround will be appreciate.
Thanks in advance.
before
after

@JarekToro
Copy link
Owner

JarekToro commented Mar 7, 2018 via email

@BarneyIt
Copy link
Author

BarneyIt commented Mar 8, 2018

Ok, first thanks a lot for your quick reply.
Maybe I was not clear enough. In a more complicated RelativeLayout architecture, my goal is to get an automatic resize of the grid to completely fill its parent, and then the parent with its anchestor and so on.
In practice what I want to get look like the behaviour of this:

public class MyUI extends UI {

protected void init(VaadinRequest vaadinRequest) {
   ....
grid.setSizeFull();
Panel panel = new Panel();
panel.setSizeFull();
panel.setContent(grid);
    setContent(panel);
}
   ....   

}

In this example I have no need to tell any fixed height to those components and in fact the grid (and its panel parent) get an automatic resize to the full available browser size.
Any hint to get what I want ?
Thanks again in advance

@JarekToro
Copy link
Owner

JarekToro commented Mar 8, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants