Well though this question is duplicated somewhat, I have searched over the net still couldn't find the exact result what i want. In my case im developing a project in JSF using Primefaces which has CRUD functionality. i have more than 3k records in p:dataTable
. If i want to update selected 5 records, i can only update the whole dataTable(takes much time).
Scenario:
1) select the records in Datatable
2) click p:commandButton
to perform business logic and will provide the result for selected records. (In p:commandButton
i used datatable updation)
Note: I can only forced to use Primefaces
. (I found omniFaces
has the solution but i shouldn't use)
Pls help me out!
PrimeFaces will allow you to update component based on styleClass
, using PrimeFacesSelectors(PFS).
update="@(.mystyle)"
You can use this to serve your purpose of updating particular row of datatable.
Here is the strategy:
1. Set unique rowKey
as styleClass
to each of columns for every row.
2. Use that rowKey
at PFS for your update
attribute.
Here is a short code snippet:
<p:dataTable var="mov" value="#{repeatUIBean.mList}" ro>
<p:column headerText="mov Name">
<h:outputText styleClass="#{mov.uniqueId}" value="#{mov.name}"/>
</p:column>
<p:column headerText="mov Release Year">
<h:outputText styleClass="#{mov.uniqueId}" value="#{mov.year}"/>
</p:column>
<p:column headerText="Edit mov">
<p:commandButton value="Edit" update="@(.#{mov.uniqueId})"/>
</p:column>
</p:dataTable>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.