Closed imorenov94 closed 3 years ago
Steps:
Add to screen SuggestionPickerField (can use code example from below)
@Inject private SuggestionPickerField<NewEntity> suggest; @Inject private Metadata metadata; @Subscribe public void onInit(InitEvent event) { NewEntity entity1 = metadata.create(NewEntity.class); entity1.setName("entity1"); NewEntity entity2 = metadata.create(NewEntity.class); entity2.setName("entity2"); List<NewEntity> entityList = Arrays.asList(entity1,entity2); suggest.setSearchExecutor((searchString, searchParams) -> { return entityList.stream().filter(entity -> entity.getName().contains(searchString)).collect(Collectors.toList()); }); } @Install(to = "suggest", subject = "optionIconProvider") private String suggestOptionIconProvider(NewEntity newEntity) { if (newEntity == null) { return null; } if ("entity1".equals(newEntity.getName())) { return CubaIcon.ADDRESS_BOOK.source(); } else if ("entity2".equals(newEntity.getName())) { return CubaIcon.BLACK_TIE.source(); } return null; }
ER:
AR: Icons haven't been installed in the search field and don't show in the dropdown list
@imorenov94
Icons should be shown for suggestions in the dropdown list
After investigation it turns out that SuggestionField has custom popup widget and it does not provide the ability to set icons by design.
Environment
Description of the bug or enhancement
Steps:
Add to screen SuggestionPickerField (can use code example from below)
ER:
AR: Icons haven't been installed in the search field and don't show in the dropdown list