Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Basic classes for adding columns to grid?
I'm trying to add an "order" column to a product grid that would essentially be a HorizontalLayout containing a TextField (amount) and a Button (order). Are there any convenient base classes like "ComponentRenderer" to start from or do I have to implement a Renderer for the column? (or am I missing a more simple way altogether?)
Thanks in advance,
I would recommend to use two columns instead of one. There is readymade TextField renderer here:
Put that into other column and then make another column with standard Button renderer if you need to do something else than just store the value. The TextField renderer stores the value directly to the container, so incase that is enough you do not need actually the button renderer at all. You could however add one button to UI for committing container changes to database.
Thanks for the reply,
I was thinking from a general point of view. For a table, you could have a ColumnGenerator that could generate an arbitrary Layout object, right? I haven't still figured out if the Grid is a replacement for a Table or if a Table would still be the way to go in cases like this...
There is overlap in features between Table and Grid, but they are not intented to be 100% match. Grid has different internal architecture in order to allow implementing features that would have been too difficult to implement in Table. The cost of this is however that some features that Table has are not doable in Grid similar manner. One example of this is that you cannot put components directly to Grid cells, instead you need to use Widget Renderers.