henrikerola / scaladin

Scala API for Vaadin Framework
126 stars 29 forks source link

MatchError, with Table/SQLContainer/Editable and custom cells #68

Open fancellu opened 9 years ago

fancellu commented 9 years ago

Looks v similar to #24

I have a Table and I set the data source via

p.setContainerDataSource(usersContainer)

usersContainer is an SQLContainer.

Now all is fine, can make it editable, save to DB. But, I now need to change one of the cells to a combo, so I try setting tableFieldFactory, but on editable=true I get a big stack trace

scala.MatchError: com.vaadin.data.util.sqlcontainer.SQLContainer@65fd0fef (of class com.vaadin.data.util.sqlcontainer.SQLContainer)
at vaadin.scala.internal.WrapperUtil$.wrapperFor(WrapperUtil.scala:13)
at vaadin.scala.Wrapper$class.wrapperFor(Wrapper.scala:9)
at vaadin.scala.AbstractComponent.wrapperFor(AbstractComponent.scala:15)
at vaadin.scala.Container$Viewer$class.container(Container.scala:161)
at vaadin.scala.AbstractSelect.container(AbstractSelect.scala:29)
at vaadin.scala.TableFieldFactoryDelegator$class.createField(FieldFactory.scala:140)
at vaadin.scala.TableFieldFactory$$anon$9.createField(FieldFactory.scala:128)
at com.vaadin.ui.Table.getPropertyValue(Table.java:4063)
at com.vaadin.ui.Table.parseItemIdToCells(Table.java:2356)
at com.vaadin.ui.Table.getVisibleCellsNoCache(Table.java:2195)
at com.vaadin.ui.Table.refreshRenderedCells(Table.java:1717)
at com.vaadin.ui.Table.refreshRowCache(Table.java:2661)
at com.vaadin.ui.Table.setEditable(Table.java:4786)

If I don't go editable OR don't mess with tableFieldFactory, its fine, but I need to do both.

In fact I do both elsewhere in my app, but container is standard inmemory IndexedContainer, and not SQLContainer.

Any idea of a way around this?

Thanks.

fancellu commented 9 years ago

Well, I found a way around this, just use a plain Vaadin Table. Not exactly ideal, but does show that what I'm trying to do isn't unreasonable.

fancellu commented 9 years ago

If this could be fixed it would be really nice, currently by code is littered with Java level hacks.

Thanks.

henrikerola commented 9 years ago

So the problem is that your are using the Vaadin SQLContainer because there is no a Scaladin wrapper for the SQLContainer?

fancellu commented 9 years ago

Yep. In the main it works fine, but as I said, in certain circumstances will go bang with a match error

rpiaggio commented 9 years ago

+1 please

getItem fails on a Table with a SQLContainer as data source.