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.

Grid Details does not show Table component

Marika Mörsky
6 years ago Jan 14, 2016 1:18pm

Hi!

A have a slight problem with using the Grid Details view. I have a DetailsGenerator which creates a HorizontalLayout with two components: a Label and a Table. When the detail row is open, it does not show the table component. Looking at the HTML, all the correct elements seem to be in place, but the table body wrapper div has heigth and width of zero pixels.

It seems like the detail element gets some fixed size, how do we decide the size of the detail container? Could this be some kind of timing problem that the detail component is not aware of the size of the components inside the layout?

@Override
    public Component getDetails(Grid.RowReference rowReference) {
        HorizontalLayout layout = new HorizontalLayout();
        layout.setSpacing(true);
        layout.setMargin(true);

        String text = "some label text";

        Label label = new Label(text);
        layout.addComponent(label);
        
        Table table = new Table("TABLE");
        table.addContainerProperty("column1", String.class, null);
        table.addContainerProperty("column2", String.class, null );

        table.setColumnHeader("column1", "COLUMN1");
        table.setColumnHeader("column2", "COLUMN2");
        table.addItem(new Object {
                        "testing column1",
                        "testing column2"},
                new Integer(0));

        layout.addComponent(table);
        return layout;
    }

 

Simo Tuokko
6 years ago Feb 11, 2016 8:20am

Hi,

Did you resolve this problem? We have very similar situation that table is not drawn when detail is opened. When opening details for another row then the previous one is drawn but it still doesn't take the space that it needs. 

Here is similar sample as yours:

@Override
            public Component getDetails(Grid.RowReference rowReference) {

                VerticalLayout layout = new VerticalLayout();
                
                Table table = new Table();
                table.setSizeFull();
                table.addContainerProperty("column1", String.class, null);
                table.addItem(new Object[]{ "text1"}, 0);
                layout.addComponent(table);
                
                //layout.setHeight("100px");
                layout.set
                return layout;
            }
        });
Simo Tuokko
6 years ago Feb 11, 2016 8:39am
Marika Mörsky
6 years ago Feb 11, 2016 8:54am
Simo Tuokko
6 years ago Feb 11, 2016 9:57am
Simo Tuokko
6 years ago Feb 12, 2016 6:34am
Teemu Suo-Anttila
6 years ago Feb 12, 2016 7:20am
Simo Tuokko
6 years ago Feb 12, 2016 7:47am
Teemu Suo-Anttila
6 years ago Feb 12, 2016 7:51am
Simo Tuokko
6 years ago Feb 12, 2016 9:35am
Simo Tuokko
6 years ago Feb 12, 2016 1:17pm