vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 729 forks source link

Columns do not expand correctly when gird is disabled #7807

Closed vaadin-bot closed 8 years ago

vaadin-bot commented 8 years ago

Originally by vinodvaadin


Dear Vaadin Team,

If Vaadin grid is disabled, the columns of the grid do not expand correctly. They expand only partly, leaving the other space blank.

Below is my complete code where I am creating a simple vaadin grid and setting grid.setEnabled(false) [line #56]

Below is the code. I have also attached a screen shot of disabled grid where in the columns have not expanded correctly leaving the space empty.


import java.util.ArrayList; import java.util.Collection;

import javax.servlet.annotation.WebServlet;

import com.vaadin.annotations.VaadinServletConfiguration; import com.vaadin.data.util.BeanItemContainer; import com.vaadin.server.VaadinRequest; import com.vaadin.server.VaadinServlet; import com.vaadin.ui.AbstractOrderedLayout; import com.vaadin.ui.Button; import com.vaadin.ui.Grid; import com.vaadin.ui.UI; import com.vaadin.ui.VerticalLayout;

public class GridTest extends UI { @WebServlet(value # {"/grid/", "/VAADIN/" }, asyncSupportedtrue) @VaadinServletConfiguration(productionMode # true, uiGridTest.class) public static class Servlet extends VaadinServlet { }

@Override
protected void init(VaadinRequest request) {
    VerticalLayout layout = new VerticalLayout();
    setContent(layout);
    layout.setSizeFull();
    final Grid g = addGrid(layout);
    Button button = new Button("Sample button");

    layout.addComponent(button);
    VerticalLayout l = new VerticalLayout();
    l.setSizeFull();
    l.addComponent(g);

    layout.addComponent(l);
    layout.setExpandRatio(l, 1.0f);
}

private Grid addGrid(AbstractOrderedLayout layout) {
    // Have some data
    Collection<Person> people = new ArrayList();
    for (int i=0; i<400; i++) {
        people.add(new Person("A "+i, i));  
    }
    // Have a container of some type to contain the data
    BeanItemContainer<Person> container =
        new BeanItemContainer<Person>(Person.class, people);

    // Create a grid bound to the container
    Grid grid = new Grid(container);
    grid.setSizeFull();
    grid.setColumnOrder("name", "id");

    grid.setEnabled(false);

    return grid;

}

}


Imported from https://dev.vaadin.com/ issue #20240

vaadin-bot commented 8 years ago

Originally by vinodvaadin


Attachment added: Grid_Column_Expand_Issue.jpg (82.0 KiB) Grid_Column_Expand_Issue.jpg https://trac-attachments.vaadin.com/trac/20240/Grid_Column_Expand_Issue.jpg Screen shot of disabled Grid wherein Columns have not expanded correctly

vaadin-bot commented 8 years ago

Originally by @Artur-


https://dev.vaadin.com/review/#/c/14394/

vaadin-bot commented 8 years ago

Originally by @Artur-


The patch actually only partially fixes the issue. The column widths are correct but the grid does not work after being enabled

vaadin-bot commented 8 years ago

Originally by @Artur-


https://dev.vaadin.com/review/#/c/14448 should fix the remaining issue