0

I have extended the TableCell class to render a date picker. Its graphic is a javafx.scene.control.DatePicker. I have had to do some onKeyPressed handling to handle tab, enter, and escape, and some other customizations to try to get this TableCell acting in a sane way. Now, when I first select the cell which already contains a value, the DatePicker shows up, but it's blank. It looks like startEdit is being called, but that doesn't provide a value to put into the DatePicker. (https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/TableCell.html)

How do I make the old value of the cell show up in the DatePicker when it first shows up?

lmat - Reinstate Monica
  • 7,289
  • 6
  • 48
  • 62

1 Answers1

1

Assuming the column type is LocalDate, just call

datePicker.setValue(getItem());

in the startEdit() method.

James_D
  • 201,275
  • 16
  • 291
  • 322