datenhahn / componentrenderer

A ComponentRenderer for the Vaadin Grid
Apache License 2.0
6 stars 8 forks source link

Component expand ratio issue #2

Closed klaath closed 8 years ago

klaath commented 8 years ago

Adding a full width(100%) component to a fully expanded column(column expand ratio is 1), does not expand the component. For example, following code in the demo generates initial width text field (not 100%) even though the column width is fully expanded:

myGrid.addColumn(COL_TEXTFIELD, Component.class)
    .setRenderer(((ComponentRendererProvider)myGrid)
     .createComponentRenderer()).setExpandRatio(1);
...
generatedPropertyContainer.addGeneratedProperty(COL_TEXTFIELD, 
    new TextFieldValueGenerator());
...
private static class TextFieldValueGenerator extends PropertyValueGenerator<Component>{
        public Component getValue(Item item, Object itemId, Object propertyId) {
            TextField field = new TextField();
            field.setWidth("100%");
                         ...
        }
        ...
    }

Isn't this the right approach?

-k

datenhahn commented 8 years ago

Hi klaath, thx for your ticket, your approach is right, I just added the full size/width of the surrounding flowpanel (which the renderer uses to display the components). If your rows are not high enough or you want to get rid of the margins to the side, I think you have to adjust the CSS.

klaath commented 8 years ago

Okay, thanks for the quick fix.

Cheers, -k

datenhahn commented 8 years ago

I just published version 0.1.2 with the fix on the addons page, so should be in maven central soon