neutrino36
(neutrino neutrino)
December 10, 2018, 3:46pm
#1
After click once, I need to modify action attribute of Create button in visible = “false”. How can I do that?
<actions>
<action id="create"
openType="DIALOG"
visible="false" />
<action id="edit"
openType="DIALOG"/>
<action id="remove"/>
</actions>
gorelov
(Gleb Gorelov)
December 11, 2018, 6:15am
#2
Hi,
You can inject Create action and add a BeforeActionPerformedHandler
, for instance:
@Named("productsTable.create")
private CreateAction productsTableCreate;
@Override
public void init(Map<String, Object> params) {
productsTableCreate.setBeforeActionPerformedHandler(() -> {
productsTableCreate.setVisible(false);
return true;
});
}
Regards,
Gleb
neutrino36
(neutrino neutrino)
December 11, 2018, 9:43am
#3
It works. Thank you.
The problem is after SAVE the button is visible again.
I tried with setEnable / isEnable but I have only two option: disable forever or enable forever.
Actually I want to perform Create action only once, after that the button should be disabled (invisible) forever.
gorelov
(Gleb Gorelov)
December 11, 2018, 12:26pm
#4
Well, if you want to create a particular entity only once, then you can check the existence of such entity and enable the create action if no entity has been created.
neutrino36
(neutrino neutrino)
December 11, 2018, 1:34pm
#6
Dear Gleb,
Can you help me please with this topic: How to debug in Idea - CUBA.Platform
Unfortunately I don’t know how to debug in Idea…