neutrino36
(neutrino neutrino)
#1
Hi,
I need to Override the default action Add Button:
I’ve tried:
@Subscribe("transactionsTable.add")
public void onTransactionsTableAdd(Action.ActionPerformedEvent event) {
screenBuilders.lookup(Transaction.class, this)
.withOptions(new MapScreenOptions(
ParamsMap.of("testValue", "Invoiced")))
.build()
.show();
}
but when I open th screen the Select button is missing…
Regards,
-n
Pinyazhin
(Roman Pinyazhin)
#3
Hello,
in this case, you have to set selectHandler in order to enable “Select” button:
screenBuilders.lookup(Transaction.class, this)
.withOptions(new MapScreenOptions(
ParamsMap.of("testValue", "Invoiced")))
.withSelectHandler(transactions -> {
transactionsDc.getMutableItems().addAll(transactions);
})
.build()
.show();
But I think the simplest way is to use lookup with Table parameter:
screenBuilders.lookup(transactionsTable)
.withOptions(new MapScreenOptions(
ParamsMap.of("testValue", "Invoiced")))
.build()
.show();
neutrino36
(neutrino neutrino)
#5
It works perfectly, thank you!
What is the difference between entityDc.getItems()
and entityDc.getMutableItems()
?
BR,
-n
Pinyazhin
(Roman Pinyazhin)
#6
-
getItems()
returns “read only” collection, you cannot add or remove item.
-
getMutableItems()
returns collection that every action (add, remove) will fire an event.
See this section for more details.