Editable Grid

I’m following this link https://martinelli.ch/vaadin-editable-grid/ and also the official doc. The examples I’ve seen so far are works(edits) only when there are some values in the grid. In my case, I want to let the user directly input the values in the grid. Any examples ?

I’ve added all editor components for each column and this is how it looks. Note there are no values in the grid.

Add an empty Item

I did like this final List<Expenses> expensesList = new ArrayList<>(); expensesList.add(new Expenses()); final ListDataProvider<Expenses> expensesListDataProvider = new ListDataProvider<>(expensesList); grid.setItems(expensesListDataProvider);. But still blank

Editor columns are only shown on demand (clicking on them)

I see. So, this is something not doable in this way in Vaadin

Well it depends; GridPro has probably such a mid and the free Grid could theoretically have something similar with custom logic, like the usage of selection or double click listener to trigger the editor

Yeah, neither Grid nor GridPro is really suited for entering new items to be honest.

There’s a feature proposal for it, for GridPro, however: https://github.com/vaadin/flow-components/issues/1219

One of my many experiments of extending Grid is here ProtoTools/src/main/java/org/vaadin/addons/tatu/prototools/ListEdit.java at master · TatuLund/ProtoTools · GitHub

The ListEdit is actually a Field, which wraps component called AutoGrid (which is extending Grid), which attempts to automatically configure the editor (works pretty ok on common use cases) and ListEdit has functionality add/remove rows.

You are probably not looking exactly this, but can grab some ideas from it.