How to set min-width and max-width for each column in Table.

Can anybody tell me the styles to set min-width and max-width for each column in Table. My requirement is to restrict resizing the column below the min-width and above the max-width and I have different min-width and max-width for each column. I tried some styles but the max-width is not getting applied and making some alignment issues.

Hi,

unfortunately I don’t think this is doable with just CSS since as you’ve noticed it will mess up aligments or other things within the Table. I created a ticket about this earlier at
http://dev.vaadin.com/ticket/3170
but apparently it’s not going to be fixed for Table. Instead the feature has been added to the new Grid component.

-tepi

Hi
Teppo Kurki
,
I noticed the feature (setMinimumWidth & setMaximumWidth) added in Grid, but the column is not resizable. How to make it resizable? I tried the following code with vaadin-7.4.0beta1. We are planning to use Grid instead of Table in our project. Are there all of the features of Table available in Grid with the latest vaadin version released or is it for future release?

        final Grid grid = new Grid();
        grid.setWidth("700px");
        IndexedContainer container = new IndexedContainer();
        
        grid.setContainerDataSource(container);
        
        final String propertyId1 = new String("first name");
        container.addContainerProperty(propertyId1, String.class, "default value");
        
        final String propertyId2 = new String("last name");
        container.addContainerProperty(propertyId2, String.class, "default value");
        

//        Column column = grid.getColumn(propertyId1);
//        column.setWidth(125);
//        column.setMinimumWidth(100);
//        column.setMaximumWidth(150);
        
        for (int i = 0; i < 25; i++) {
            
            Item item = container.addItem("itemId" + i);
            
            Property itemProperty1 = item
                    .getItemProperty(propertyId1);
            
            itemProperty1.setValue("first name" + i);
            
            Property itemProperty2 = item
                    .getItemProperty(propertyId2);
            
            itemProperty2.setValue("last name" + i);

        }