Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can i Update a Table (not datatable) with a Primefaces CommandButton

<h:form id="tableForm">
   <table id="myTable">
     <tr>
       <th>HeaderOne</th>  
       <th>HeaderTwo</th>
       <th>HeaderThree</th>
     </tr>
     <ui:repeat value="#{myBean.List}" var="row">
       <tr class="myRows">
         <td><input type="text" value="#{row.fieldOne} required="required" /></td>
         <td><input type="text" value="#{row.fieldTwo}  /></td>
         <td><input type="text" value="#{row.fieldThree} /></td>
       </tr>
     </ui:repeat>
   </table>
   <p:commandButton id="myButton" value="Load" action="#{myBean.load}" process="@this" update="myTable" />
</h:form>

i want to load some stuff into my inputFields from my bean, but have one field that is required when i press save. So i have to set process to @this.

Afterwards i want my table to be updated. But i doesn't work.

What am i doing wrong?

like image 983
Lumpi47 Avatar asked Feb 12 '23 19:02

Lumpi47


1 Answers

try updating the form instead

<p:commandButton ... action="#{myBean.load}" process="@this" update="tableForm" />

since the table is not a jsf element but "pure" html, you can't use it's id in jsf elements

like image 98
Schäbo Avatar answered Feb 16 '23 03:02

Schäbo