Question

I'm developing a webapplication in the Vaadin framework. I have a table with 14 columns. The last column holds three icons and a problem I'm having is that like half of the time the table is rendered the icon furthest to the right will be "cut in half" vertically. To avoid this problem I tried to set a fixed width to this column that I think would eradicate the problem, however, nothing happens..

I'm using the conventional approach:

simCardTable.setColumnWidth(actionColumn, 135);

However, no matter what value I set to be the column width the column stays the same... Does anyone know why this is? Is it because it's the last column to be added and therefore there's no space to spare..?

Btw, that is the only column I set a specific width to, all of the restoring columns have a the standard width specified by the width of the column header or the cell content.

Any help would be very appreciated!

Was it helpful?

Solution

As i understand from your question ("The last column holds three icons") you use ColumnGenerator to create this last column, with icons. If I right, it mean that you created some sort of custom layout with this icons inside, in this case for you should work this:

final ColumnGenerator generator = new ColumnGenerator() {
            private static final long serialVersionUID = 1L;

            @Override
            public Component generateCell(Table source, final Object itemId, Object columnId) {
                final HorizontalLayout layout = new HorizontalLayout();
                layout.setSizeFull();

                Embedded icon1 = new Embedded();
                Embedded icon2 = new Embedded();
                Embedded icon3 = new Embedded();

                //Add some themeresource to embedded components

                //Do some listners to this icons

                layout.addComponent(icon1);
                layout.addComponent(icon2);
                layout.addComponent(icon3);

                //Set column with
                setColumnWidth(columnId, 100);

                return  layout;
                }
            };
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top