Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Vaadin Grid - resize column but have a minimum clumn width

Ulrich Krause
5 years ago Sep 02, 2016 5:29am
Alejandro Duarte
5 years ago Sep 02, 2016 12:38pm
Ulrich Krause
5 years ago Sep 05, 2016 7:38am

Hi Alejandro. Yes, I have tired this without success.

I ended up with some CSS that I apply 

.nolessthan {
    width: 310px;
    min-width: 300px;}

  grid.setCellStyleGenerator(new CellStyleGenerator() {
            private static final long serialVersionUID = -8832838853469882824L;
            @Override
           public String getStyle(final CellReference cellReference) {
                if (cellReference.getPropertyId().equals(CELL_SOURCESERVER)
                        || cellReference.getPropertyId().equals(CELL_USERNAME)) {
                    return "nolessthan";
                }  else {
                    return null;
                }
            }
        });

This does the trick.