0
votes

I have a list of p:datatables, for each I need row selection event. But only last datatable works. If I select a row in others datatables I see that onRowSelected method is called, but object is null.

I think that in c:foreach the ajax listener is overwritten, so only last works. How to solve ?

this is my xhtml code:

 <c:forEach items="#{azPrimaDisponibilita.selectedCompany}" var="companyCode" varStatus="loop">
   <p:dataTable id="tablePerformance_#{companyCode}" rendered="#{azFirstAvail.isCompanyVisible}"  widgetVar="tablePerformance" var="performance" value="#{azFirstAvail.listPerformances.get(loop.index)}" 
                styleClass="perfDataTable no-border" rowIndexVar="rowIndex"
                selectionMode="single" selection="#{azFirstAvail.selectedRowCompany}" rowKey="#{performance.id}">
      <p:ajax event="rowSelect" global="true" listener="#{azFirstAvail.onRowSelectCompany}" update="formPerformance,pageSubDescription,pageDescription"/>
    ....
1

1 Answers

0
votes

I solved. widgetVar is equal in loop, I need to set different id in widgetVar