我有一个p:datatables列表,每个列表都需要行选择事件。 但是只有最后一个数据表有效。 如果我在其他数据表中选择一行,则会看到调用了onRowSelected方法,但是object为null。
我认为在c:foreach中,ajax侦听器被覆盖,因此只有最后一种有效。 如何解决?
这是我的xhtml代码:
<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"/>
....
答案 0 :(得分:0)
我解决了。 widgetVar在循环中是相等的,我需要在widgetVar中设置不同的ID