TextField or PopupDateField in Table (ContainerDataSource)

Hi,

is it possible to add TextField / PopupDateField or any other vaadin components when using a table with ContainerDataSource (Hibernate) attached?

Since TextField and PopupDateField both implement the
Property
interface, you can simply override
Container.getContainerProperty(…)
and return them as appropriate.

Your solution might work, didn’t tested out yet.

I was successful with another approach: setTableFieldFactory(…)


		table.setTableFieldFactory(new DefaultFieldFactory() {
			@Override
		    public Field createField(Container container, Object itemId, Object propertyId, Component uiContext) {
		        if (propertyId.equals("project")) {
		        	ComboBox cb = new ComboBox();
				// adds current value from table into ComboBox, otherwise ComboBox would have no items that could be selected by user
		        	cb.addItem(table.getItem(itemId).getItemProperty(propertyId).getValue());
				// new value can be submitted by user
		        	cb.setNewItemsAllowed(true);
		        	cb.setWidth("100px");
		            return cb;
		        }
		        if (propertyId.equals("activity")) {
					TextField tf = new TextField();
					tf.setWordwrap(true);
					tf.setRows(3);
					tf.setWidth("300px");
		            return tf;
		        }
		        
		        // Otherwise use the default field factory 
		        return super.createField(container, itemId, propertyId, uiContext);
		    }
		});

I also tested PopupDateField without problems.