How to set Rendered parameter via bean JSF 2

1

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?

    
asked by anonymous 26.11.2015 / 16:22

1 answer

0

Friend,

Attempts to use f: ajax with the event = attribute to trigger the event and a listener or action to execute call the ManagedBean method and the render attribute to update the other panel. Would not that be the best and least laborious solution? I never created it any other way. Hope it helps.

    
27.11.2015 / 02:01