How to set Jfxtras LocalDateTimeTextField value without click confirm button?

206 views Asked by At

I click localeDateTimeTextField and pop-up open. I select a different value from default. When I click any other space, pop-up close, but not set value which I select. I want to set my localeDateTimeTextField component value without click confirm button when I close it.

Is there a pop-up close action for set value which I choose from pop-up on close action? or any other way?

dtSpecificDate = new LocalDateTimeTextField();
    dtSpecificDate.withLocalDateTime(LocalDateTime.now());//
    dtSpecificDate.setMaxWidth(170.0);
    dtSpecificDate.setDisable(true);
    dtSpecificDate.setDateTimeFormatter(DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm"));
    gridRadioGroup.add(dtSpecificDate, 1, 1);
1

There are 1 answers

3
tbeernot On

When setting the datetime, there are multiple controls that can be changed in the popup, so there needs to be an official "accept what is set now" moment. That is the ok button. The question of course is what to do when the popup is closed because you click outside. In this case the input is not accepted, and that is your problem.

Thus the answer to your question is: no (not at the moment).

But if you have a good use case for your behavior it can be added, of course. "AcceptValueOnClose" would be an option, but I'm not too exited about that approach. Can you tell a bit about why you need that?

An alternative behavior would where the value is continuously updated with every UI interaction. Basically that is what the CalendarPicker does as well, it does not have an ok button. That would be more acceptable to me, but then the application needs to provide an undo option.

Would a continuous update be an acceptable solution for you use case?