Is it possible to open the date selection calendar of the PopUpDateField
programmatically?
I want to have something like a DateRangeField
in Vaadin. It's made up of two PopUpDateField
's one for the first value ("from") and the other one for the "to" value. When the "from" value is changed I want that the calendar selection opens automatically for the "to" value, without the user needing to press the calendar icon of the "to" field.
I can't find this functionality anywhere in the Vaadin DateField components
As far as I know there's no built-in support for that in the Vaadin DateField
.
The cleanest solution would be to create your own Vaadin extension, which would provide server-side API to open the popup for a DateField
.
The easiest but a bit hackish solution is to defined a unique id for your datefield
dateField.setId("my-datefield");
and use Vaadin JavaScript API to execute a JavaScript snippet that clicks a button in the DateField's client-side element:
JavaScript.eval("document.getElementById('my-datefield').childNodes[1].click()");