Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think you are using the row selection in a wrong way. The attribute <code>rowSelectListener</code> needs to point to a method with this signature (as to the <a href="http://www.primefaces.org/showcase/ui/datatableRowSelectionInstant.jsf" rel="nofollow">Primefaces showcase</a>):</p> <pre><code> public void onRowSelect(SelectEvent event) { ... } </code></pre> <p>In your <code>p:dataTable</code> you need to refer to this method this way:</p> <pre><code>&lt;p:dataTable var="car" value="#{tableBean.cars}" paginator="true" rows="10" selection="#{tableBean.selectedCar}" selectionMode="single" rowSelectListener="#{tableBean.onRowSelect}" </code></pre> <p>Notice how the listener method is refered to.</p> <p>With this you get the selected row object in <code>tableBean.selectedCar</code>.</p> <p>A complete example is given in the showcase (link above).</p> <p><strong>UPDATE</strong> From your comments:</p> <p>This is the problem:</p> <pre><code>value="#{projet.init()}" </code></pre> <p>The value attribute needs to refer to a list or something containing your data and not to a method. If you have for instance a class Project and want to display a list of projects in the table, your backing bean has to contain something like this:</p> <pre><code>private List&lt;Project&gt; projects; public List&lt;Project&gt; getProjects() { return projects; } public void setProjects(List&lt;Project&gt; projects) { this.projects = projects; } </code></pre> <p>In the <a href="http://www.primefaces.org/showcase/ui/datatableRowSelectionSingle.jsf" rel="nofollow">primefaces showcase</a> its the <code>carSmall</code> list that does the same. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload