Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Form Field Order
I am creating a form using the BeanItem class. When I use the following code snippet, my form does not appear:
List<Object> orderedProperties = Arrays.asList(ReflectionUtil.getField("NATURAL_COL_ORDER")); setItemDataSource(new BeanItem(entity), orderedProperties);
If I use the following code snippet, my form does appear, but the fields from the BeanItem are listed alphabetically and I don't want them listed alphabetically. I want them listed in the order of "NATURAL_COL_ORDER".
setVisibleItemProperties((Object) ReflectionUtil.getField("NATURAL_COL_ORDER")); setItemDataSource(new BeanItem(entity));
So, for some reason my application doesn't like the call to
setItemDataSource(Item datasource, Collection properties)
Any ideas on how to get that call to work or how to reorder the columns using setVisibleItemProperties?
Sounds like a strange problem. Do you get any exceptions or other error messages?
Anyways, make sure that your orderedProperties collection contains the correct values. For example a getter that looks like this: getMyLovelyProperty() should be written as "myLovelyProperty" in the orderedProperties collection.
If this isn't the case, maybe you can provide a small test application that shows the problem?
The class I created extends Form. Originally I was calling setVisibleItemProperties(...). When I changed the call to super.setVisibleItemProperties(...) that did the trick.