I want to create a Vaadin 8 grid in which I can edit the value in the column Amount (2) using a slider (analogous to this example).
I use the following code to create the grid.
fun createGrid(): Grid<Concept> {
val grid = Grid<Concept>()
val dataProvider = ListDataProvider<Concept>(ctl.getConcepts())
grid.dataProvider = dataProvider
grid.addColumn(Concept::getName)
.setId("ID")
.setCaption("ID")
grid.addColumn(Concept::getDescription)
.setId("desc")
.setCaption("Description")
grid.addColumn(Concept::getOutput)
.setId("amountNumber")
.setCaption("Amount")
val conceptAmountditor = Slider()
conceptAmountditor.setWidth(100.0f, Sizeable.Unit.PERCENTAGE)
conceptAmountditor.min = 0.0
conceptAmountditor.max = 100.0
grid.addColumn(Concept::getOutput, ProgressBarRenderer())
.setId("amountBar")
.setCaption("Amount (2)")
.setEditorComponent(
conceptAmountditor,
Concept::setOutput
)
.setEditable(true)
grid.setSizeFull()
return grid
}
But when I click on the individual rows, no slider appears.
What is wrong with my code? How can I make the progress bar transform into a slider when I double click a particular row?
