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

Grid has wrong width if no header #10485

Closed
fante76 opened this issue Jan 2, 2018 · 6 comments
Closed

Grid has wrong width if no header #10485

fante76 opened this issue Jan 2, 2018 · 6 comments
Assignees
Labels

Comments

@fante76
Copy link

fante76 commented Jan 2, 2018

Vaadin Framework 8.2.0

A grid without header (by grid.removeHeaderRow(0)) doesn't apply width settings, both on single columns then in whole grid.
The following code works on Vaadin 8.7.1

capGrid.setItems(capabilities);
capGrid.removeHeaderRow(0);
capGrid.setColumns("name");
capGrid.getColumn("name").setExpandRatio(1).setWidth(200);
capGrid.setSizeFull():

image

@rappenze
Copy link

This bug was introduced with pull request #10384. The code to add select all checkbox does not check if the header exists.
missingnullcheck

So this bug is limited to grids where no default header row exists and the grid is in multi select mode.

Client side exception is:
image

@stale
Copy link

stale bot commented Jun 21, 2018

Hello there!

It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

  • Check if the issue is still valid for the latest version. There are dozens of duplicates in our issue tracker, so it is possible that the issue is already tackled. If it appears to be fixed, close the issue, otherwise report to the issue that it is still valid.
  • Provide more details how to reproduce the issue.
  • Explain why it is important to get this issue fixed and politely draw others attention to it e.g. via the forum or social media.
  • Add a reduced test case about the issue, so it is easier for somebody to start working on a solution.
  • Try fixing the issue yourself and create a pull request that contains the test case and/or a fix for it. Handling the pull requests is the top priority for the core team.
  • If the issue is clearly a bug, use the Warranty in your Vaadin subscription to raise its priority.

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

@stale stale bot added the Stale Stale bot label label Jun 21, 2018
@buuzta
Copy link

buuzta commented Sep 4, 2018

Bug still exists in Vaadin 8.5.1.
Happens either with removeHeaderRow(0) or setHeaderVisible(false).

@stale stale bot removed the Stale Stale bot label label Sep 4, 2018
@pleku pleku added the BFP label Sep 4, 2018
@anasmi
Copy link
Contributor

anasmi commented Sep 4, 2018

Hi,

please, correct me, if I am wrong, but I don't think this is a bug per se.
In your code you are setting explicitly the width and the expand rate on the same column simultaneously. In this case width is taking precedence.(The result you see) If you want to specify the minimum width column should have, then you should probably use setMinimumWidth.

                   Grid<String> grid = new Grid<>();
                    grid.addColumn(ValueProvider.identity());
                    grid.addColumn(String::valueOf).setExpandRatio(1).setWidth(250);
                    grid.setItems("a", "b");
                    grid.setSizeFull();
                    grid.setSelectionMode(Grid.SelectionMode.MULTI);
                   // grid.setHeaderVisible(false);

The code above produce to me the same visual result regardless of me having header column or not. (I hope its reproduce your use case also)

Using setWidth:
withwidth

Using setMinimunWidth instead:

withminwidth

Have I miss something? Could you share the code you have, if it's not the same as above?

@fante76
Copy link
Author

fante76 commented Sep 4, 2018

My code is written above. The problem happens using grid.removeHeaderRow(0), you are not using it on your example. May be your workaround fits, I will try as soon as possible, but you can't said its not a bug.

@anasmi
Copy link
Contributor

anasmi commented Sep 5, 2018

Hi,

indeed you are correct. When removing the row like you did I was able to reproduce the back.
In a meanwhile, you can use grid.setHeaderVisible(false); as a workaround, but problem does indeed exist.

Thanks for clarifications!

@anasmi anasmi self-assigned this Sep 5, 2018
anasmi pushed a commit to anasmi/framework that referenced this issue Sep 5, 2018
Fix vaadin#10485
If header row is not present, than there is no need to make SelectAllCheckbox visible. Otherwise, NPE is thrown on the client side and widths is not applied properly.
anasmi pushed a commit to anasmi/framework that referenced this issue Sep 7, 2018
elmot pushed a commit that referenced this issue Sep 7, 2018
Ensure that HeaderRow is not null in Grid

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

No branches or pull requests

5 participants