How to display only years and months without days in a pop-up window in Vaadin datepicker? Is there such a possibility? See the example in the screenshot
CodePudding user response:
DatePicker doesn't have that kind of functionality, at least at the moment. Probably the easiest way to implement a popup for a year and a month would be a Dialog with two Select components.
Dialog dialog = new Dialog();
List<String> collect = IntStream.rangeClosed(2000, 2022).boxed()
.map(integer -> integer.toString()).collect(Collectors.toList());
Select<String> yearSelect = new Select<String>(collect.toArray(new String[0]));
Select<String> monthSelect = new Select<>("Jan", "Feb", "...");
dialog.add(yearSelect, monthSelect);
dialog.open();