Vaadin 8: Alternative to AbstractSelect.setNewItemsAllowed()

I was using setNewItemsAllowed() method in Vaadin 7 for adding new Items (from the UI) to AbstractSelect child components.
What is the alternative to it in Vaadin 8?

Thank you!

Hi,

do you have a usage example of the way it used to work?

-Olli

ListSelect listSelect = new ListSelect(); listSelect.addItems(myItemsList); listSelect.setNewItemsAllowed(true); listSelect.setNewItemHandler(new AbstractSelect.NewItemHandler() { @Override public void addNewItem(String s) { MyItem item = new MyItem(); item.setName(s); setMyItemModel(item); } }); Attached screenshot shows how it looked on the UI.
Thank you!
34523.png

That’s a good, question, I’ll need to look into it :slight_smile:

-Olli

Hi,

as far as I can tell, that feature just doesn’t exist any more, as AbstractSelect itself is gone and there’s a different class hierarchy beneath selection components now. I hadn’t even seen NewItemHandler before myself, so it took me a while to figure out what was going on. Fortunately, it doesn’t look like it would be too difficult to create that same functionality in your own custom component.

Best,

Olli

All right, thanks a lot for your time Olli!

Best Regards,
Vitali