I need to react to changes of text, that is written in combobox input field.
The ValueChange of ComboBox ist reacting to selecting an Item, but i must make different Actions depending on what text is written into the Combobox.
MY endpoint is to change the sorting. Not the Filtering ! Custom Filtering is easy.
I can achieve the sorting by using reflections and combining it with filtering (Field = currentFilterText), my question is, can i somehow do it without reflextions ?
example, i have 3 Items, they have ID and description;
Item item1 = new Item(11L, "131311");
Item item2 = new Item(12L, "13111213");
Item item3 = new Item(13L, "111213");
box.setItemCaptionGenerator(i -> i.getId() + ":" + i.getDescription());
now when i write “13” into the Field, i want the item with the ID 13 to be sortet at the top.(Current Behavior = item1 will be selected)
If there is no item with exact ID, behave normal.
It is simplistic example, in real aplication i want to recognise what Type of date was written and sort depending on input. It could be name, article number, or other internal formats.
I believe that is not currently a very well supported scenario. I thought of one other possible way of achieving the effect, creating a [lazy filtered dataprovider]
(https://vaadin.com/docs/v8/framework/datamodel/datamodel-providers.html) that creates (and orders) the dataset based on the filter. I haven’t tried it in practice, though, but it could work.
You don’t actually need lazy loading for your services to use a lazy DataProvider, you can just create a quick mock backend. But that would be more or less on the same hackiness level as your reflection solution - which seems to work ok to me