0

I have got a Vaadin Combobox (Vaadin 8) to which I add two items. I would like that ComboBox to propose all views to which the user is supposed to navigate by a Vaadin NativeButton as described in the code snippet. In spite of the fact that "ContactView" is proposed below the ComboBox as soon as I type a "C", I cannot select "ResourceView" - and yet I have added it to theComboBox. What did I get wrong so that there is no correct dropdown?

        navigatorCombobox = new ComboBox<String>("Navigate to...");
        
        navigatorCombobox.setItems(Arrays.asList("ContactView", "ResourceView")); 
        
        navigatorButton = new NativeButton("go");
        
        navigatorButton.addClickListener(
                event -> { 
                    if(StringUtils.isNotEmpty(navigatorCombobox.getValue()) && navigatorCombobox.getValue().equals("ContactView")) {

                    getUI().getNavigator().navigateTo(MynavigatorUI.CONTACTVIEW);
                    
                 } else if (StringUtils.isNotEmpty(navigatorCombobox.getValue()) && navigatorCombobox.getValue().equals("ResourceView")) {

                        getUI().getNavigator().navigateTo(MynavigatorUI.RESOURCEVIEW);

                        }
        }); 


Andferdd
  • 91
  • 3

1 Answers1

0

This is intended behavior. Once you type "C" in the field, ComboBox will limit selectable options to those starting with "C".

Tatu Lund
  • 9,949
  • 1
  • 12
  • 26
  • Yes, that's clear - but as soon as I type "R" in the field, no word starting with "R" is proposed :( – Andferdd Jul 27 '21 at 06:46