When i open a table by clicking the ellipse on a picker field,
I can choose any of the items by double-clicking it without any problems. The issue comes when I want to make that same selection by using a confirm button.
if (isValid(person)) {
closeWithDefaultAction();
PersonpersonSelected = dataManager.create(Person.class);
notifications.create().withCaption("Selected").show();
}
@Named("orderField.lookup")
private LookupAction<Order> orderFieldLookup;
@Subscribe
public void onInit(InitEvent event) {
orderFieldLookup.setSelectValidator(context -> {
Collection<Order> orders = context.getSelectedItems();
if (orders.size() == 1) {
Order order = orders.iterator().next();
return "order 1".equals(order.getNumber());
}
return false;
});
}
You can disable approving items by double-click but still able to select items by clicking them. To achieve this you can do the following in the Lookup Screen:
@Inject
private HBoxLayout lookupActions;
@Inject
private GroupTable<OrderLine> ordersTable;
@Subscribe
public void onAfterShow(AfterShowEvent event) {
if (lookupActions.isVisible()) {
// Opened as lookup screen
ordersTable.setItemClickAction(new BaseAction("lookup_select_stub"));
}