1
votes

I'm trying to use the "multiple select" in a dataTable. My data model to fill the dataTable is an ArrayList<ArrayList>. My problem is that the selectEvent variable is consistently null and no data is available in the bean.

XHTML:

<p:dataTable id="dt_notselectedContent"
   var="notselectedContent"
   value="#{verwaltung.alNotSelectedContent}"
   rows="5"
   rowIndexVar="rowIndex"
   selectionMode="multiple"
   selection="#{bean.alContent}"
   rowKey="#{bean.alNotSelectedContent.get(rowIndex).get(0)}"
   paginator="true"
   paginatorTemplate="{CurrentPageReport} {RowsPerPageDropdown}"
   rowsPerPageTemplate="5,10"
   rendered="#{not empty verwaltung.alNotSelectedContentForLinkedList}"
   style="width: auto; height: auto">

   <p:ajax event="rowSelect" listener="#{verwaltung_store.onRowSelect(event)}" />
2
does it work ??Bilal Dekar
remove the 'event' from the listener... it is explicitly populated!Kukeltje
the problem was the rowKeyAndreas

2 Answers

0
votes

When selecting in dataTable, the attribute rowKey is very important, which is used to identify the elemnts of dataTable, so rowKey should be a unique identifier of a row.

As i can see in you code rowKey is realy a mess, you should use a unique identifier for instance the primary key of entity, or any attribute that you defined unique.

You can find this in Primefaces Documentation:

RowKey should be a unique identifier from your data model and used by datatable to find the selected rows. You can either define this key by using the rowKey attribute or by binding a data model which implements org.primefaces.model.SelectableDataModel.

0
votes

rowKey was very false syntax

correct syntax vor rowKey

rowKey="#{notselectedContent[0]}"

this is the column with my unique primary Key