Update does not work when trying to update a <p:panelGrid>

Asked

Viewed 672 times

0

I have a button inside a <p:toolbarGroup> where I do some operations, I also have a <p:panelGrid> which should be rendered after the user clicks the button, but I cannot update this component. I can update the table and values of the toolbarGroup but the rest not.

Button code:

<p:commandButton value="Gerar Relatórios" style="margin-left:10px"
        actionListener="#{relatorioBean.gerarRelatorio()}"
        rendered="#{relatorioBean.listaVazia == true}" id="btnGerar"
        update=":msgGlobal :frmPrin:arquivoTable :frmPrin:pnlCadastro" />

Panelgrild:

<p:panelGrid columns="2" id="pnlCadastro"
        style="width:100%;margin-top:20px" columnClasses="rotulo, campo"
        rendered="#{relatorioBean.listaVazia == false}">

As you can see this panel is only rendered when the condition is false, but when I click the button the condition changes to false, only the panel that does not even update.

The component is only updated after a F5. Why isn’t the update working? Am I forgetting something?

  • tried the process="@this" on the button?

  • Already @Rafael, it did not work and it also gives error in the processes. I’m doing a test and the condition of the Renderer is false, but it does not appear. kk

  • Look, here’s when I enter the system, down there I’m displaying the variable Boolean: http://i.stack.Imgur.com/iSfyI.png

  • After I click on the button it turns FALSE, now that the panel was supposed to appear but it does not appear: http://i.stack.Imgur.com/v9Opk.png

  • Strange that until the update of <h:outputText> is working

  • Well, first of all, watch out for the inlines in your encoding, they are not considered good practice. ;) Make sure that the list you are picking up is getting a bean value. Maybe (depending on the scope you set in the backing bean) it is being reset or even not initialized. I hope I helped. P.S.: I did not comment on your question for lack of reputation.

  • The list is working correctly and the inlines are for testing.

  • I know it’s kind of trivial, but have you ever tried to play a system.out on the get list that’s on the backing bean?

  • You are updating an unprocessed component. Update the parent component of your panelGrid. If you do not want to update the whole form, enclose it in a p:panel and then updates such a panel.

  • Already yes, and if the list had not worked my datatable would not be filled

  • Try to isolate it in another form or in a <h:panelGroup>.

  • That’s right @Rodrigo answer the question so I can mark it as correct.

  • Already solved the problem thanks

  • @Techies Could post the solution as answer?

  • I’m waiting to see if @Rodrigo responds because he helped me in the comments

Show 10 more comments

1 answer

0


The problem is that you are trying to update a component - using the update - that is not yet rendered. Even if in the current action it changes the condition of the rendered for real.

To solve this, the update should be done in the parent component of what has not yet been rendered. I advise to include you in a <p:panel> and inform their id on update of your commandButton.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.