Is it possible to add new column to table with containerDataSource(SQLContainer)? In this added column user puts new data and I save these data as new row in table. I found method addGeneratedColumn but I cannot understand how can I implement adding new column virtually…
I devised other idea for it. I write dynamically created textfields with labels on Panel like that:
Not sure how the SQL container would react to it but you can try
container.addContainerProperty(propertyId, type, default);
and see if it works or not.
I tried do with your solution but it doesn’t work. I’ve got exception:
java.lang.UnsupportedOperationException
at com.vaadin.data.util.sqlcontainer.SQLContainer.addContainerProperty(SQLContainer.java:1341)
I put in code:
TableQuery tq = new TableQuery(“table1”, connectionPool, new MSSQLGenerator());
container = new SQLContainer(tq);
container.addContainerProperty(“test1”, Label.class, null);
I tried add:
table.setEditable(true);
table.addContainerProperty(“test1”, Label.class, “-”);
And I’ve got the same error:
java.lang.UnsupportedOperationException
at com.vaadin.data.util.sqlcontainer.SQLContainer.addContainerProperty(SQLContainer.java:1341)