I'm facing a small challenge where I need to dynamically create a dashboard from a drop down.
It is functional but there is a button in each Panel that rendering it depends on the existence of another panel.
Logic:
If PanelCity exists, PanelPanel can not render the button.
In my Bean I did the following:
CommandButton excluirBtn = new CommandButton();
excluirBtn.setIcon("fa fa-trash");
excluirBtn.setTitle("Remover");
excluirBtn.setActionExpression(methodExpression);
excluirBtn.processUpdates(FacesContext.getCurrentInstance());
excluirBtn.setUpdate("dashboard");
excluirBtn.setRendered(!hasComponentOnDashbaord("panel_3")); //<-Linha que impede renderização do componente se o painel existir.
It works correctly at the time of creating But it does not check after it has been rendered if the Panel has been deleted.
How to do this dynamically by Bean?