0

I have a p:dataTable. In this table, I have a checkbox in a column. This is the code:

<p:selectBooleanCheckbox 
    value="#{var.selected}"
    itemLabel="#{var.description}" 
/>

After I add a row and update the whole table, the selected checkboxes after the row inserted have the checks shifted up! But it's only a graphical problem! The checkboxes that now appears unchecked are yet checked, because I show other things in the row if the checkbox is selected. On the contrary, the checkbox that now appear checked do not show the additional components.

I checked the html, and the classes and attributes that make them checked disappears. But debugging the backend I see that the in the list connected to the table, after the add, all the items have the expected value.

This is a minimal reproducible example: https://ufile.io/6a60kxpn

Marco Sulla
  • 15,299
  • 14
  • 65
  • 100
  • Please provide a [mcve] – Jasper de Vries Jul 29 '21 at 17:51
  • @JasperdeVries I found that the problem is due to `immediate="true"` to the button that adds rows to the table. The problem is that without that, I can't add rows without first compile the entire table..... – Marco Sulla Aug 03 '21 at 13:16
  • @JasperdeVries I added the minimal reproducible example. You can see that without `immediate="true"` all works, but I need it to not trigger the form validation. – Marco Sulla Aug 23 '21 at 15:36

1 Answers1

0

I don't know why, but I solved putting process="@this" to the actionButtons. If someone can explain me why, I'll accept the answer.

Marco Sulla
  • 15,299
  • 14
  • 65
  • 100