Hi I have problem with initial settings for buttons in my screen. Screen is of type LookupScreen a have two parts - list of projects (left part) and list of tasks or project participants for project (right part with tabs). I have problem to set both create buttons in right part (for tasks and project participants) to be disabled when screen is created and no project is selected. I tried to set them as disabled through the cuba studio both programmatically and via editor. I think it has something to do with itemChangeListener() methods which I use to dynamically check constraints of selected entities. Can you help me?
Screenshot of GUI:
Hi, @jzfkamensky
you should add a listener to the datasource with project for the ItemChangeEvent
. And inside of this listener you can enable or disable your buttons:
projectDs.addItemChangeListener(e -> {
taskCreateButton.setEnabled(e.getItem() != null);
participantsCreateButton.setEnabled(e.getItem() != null);
});
Regards,
Daniil
Thanks for reply,
I solved this issue by myself but I forgot to post solution here and mark topic as solved.
In my case the problem was due to creation of custom create actions for task and participant. In all code I was disabling original create action and not the custom one.