Bug?: Table does not display well when height(null) and only Gene

A table displays badly when it has:

  • only generated columns, and
  • setHeight(null)

It displays only one line instead of many, in the example below.

The example below shows the problem.
To make it work better, just uncomment either lines:
// visibleCols = {“field1”, “col1”, “col2”, “col3”}; // With this line it works
// table.setHeight(“300px”); // This line makes the table work


package com.example.vaadintest;

import java.util.ArrayList;
import java.util.List;

import com.vaadin.Application;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.Component;
import com.vaadin.ui.Label;
import com.vaadin.ui.Table;
import com.vaadin.ui.Window;
import com.vaadin.ui.Table.ColumnGenerator;

public class VaadintestApplication extends Application {
	@Override
	public void init() {
		Window mainWindow = new Window("Vaadintest Application");
		setMainWindow(mainWindow);

		Label label = new Label("Hello Vaadin user");
		mainWindow.addComponent(label);
		
		Table table = new Table();
		table.setPageLength(0);
		
		table.setHeight(null);
//		table.setHeight("300px");   // This line makes the table work
		
		List<Pojo> pojoList = new ArrayList<Pojo>();
		pojoList.add(new Pojo("aaa", "bbb", "ccc"));
		pojoList.add(new Pojo("aaa", "bbb", "ccc"));
		pojoList.add(new Pojo("aaa", "bbb", "ccc"));
		pojoList.add(new Pojo("aaa", "bbb", "ccc"));
		pojoList.add(new Pojo("aaa", "bbb", "ccc"));
		pojoList.add(new Pojo("aaa", "bbb", "ccc"));
		pojoList.add(new Pojo("aaa", "bbb", "ccc"));
		
		table.addGeneratedColumn("col1", new MyColumnGenerator());
		table.addGeneratedColumn("col2", new MyColumnGenerator());
		table.addGeneratedColumn("col3", new MyColumnGenerator());

		table.setContainerDataSource( new BeanItemContainer<Pojo>(pojoList) );
		
		String[] visibleCols = {          "col1", "col2", "col3"};
//		         visibleCols = {"field1", "col1", "col2", "col3"};  // With this line it works
		table.setVisibleColumns(visibleCols);  // Set the column order.

		mainWindow.addComponent(table);
	}

	class MyColumnGenerator implements ColumnGenerator {
		public Component generateCell(Table source, Object itemId, Object columnId) {
			return new Label("generated");
		}
	}
	
	public class Pojo {
		String field1;
		String field2;
		String field3;
		Pojo (String f1, String f2, String f3) {
			field1 = f1;
			field2 = f2;
			field3 = f3;
		}
		public String getField1() {
			return field1;
		}
		public void setField1(String field1) {
			this.field1 = field1;
		}
		public String getField2() {
			return field2;
		}
		public void setField2(String field2) {
			this.field2 = field2;
		}
		public String getField3() {
			return field3;
		}
		public void setField3(String field3) {
			this.field3 = field3;
		}
		
	}
}

Ticket, please! :wink:

Best Regards,
Marc

Do you mean I should open a ticket, or do you expect somebody else to do it (or has it already been open and can we have the link) ?