Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you forgot to attach rowCheckListener to your datatable like this </p> <pre><code> &lt;p:ajax event="rowSelectCheckbox" listener="#{forTest.check}" /&gt; </code></pre> <p>below code is working for me. i am able to see the id and decision on the dialog.</p> <p><strong>XHTML</strong>: i dint implement <strong>selectableDataModel</strong>, i just used <strong>rowKey attribute of datatable</strong>, you could use that as well</p> <pre><code>&lt;h:form id="form"&gt; &lt;p:dataTable id="multiCars" var="car" value="#{forTest.carList}" paginator="true" rows="10" rowKey ="#{car.id}" selection="#{forTest.selectedCars}" &gt; &lt;p:ajax event="rowSelectCheckbox" listener="#{forTest.check}" /&gt; &lt;f:facet name="header"&gt; Checkbox Based Selection &lt;/f:facet&gt; &lt;p:column selectionMode="multiple" style="width:18px" /&gt; &lt;p:column headerText="id"&gt; #{car.id} &lt;/p:column&gt; &lt;p:column headerText="decision" &gt; #{car.decision} &lt;/p:column&gt; &lt;f:facet name="footer"&gt; &lt;p:commandButton id="multiViewButton" value="View" icon="ui-icon-search" update=":form:displayMulti" oncomplete="multiCarDialog.show()"/&gt; &lt;/f:facet&gt; &lt;/p:dataTable&gt; &lt;p:dialog id="multiDialog" header="Car Detail" widgetVar="multiCarDialog" height="300" showEffect="fade" hideEffect="explode"&gt; &lt;p:dataList id="displayMulti" value="#{forTest.selectedCars}" var="selectedCar"&gt; id : #{selectedCar.id}, dateEnvoi #{selectedCar.decision} &lt;/p:dataList&gt; &lt;/p:dialog&gt; &lt;/h:form&gt; </code></pre> <p><strong>ManagedBean</strong>:</p> <pre><code>package managedbeans; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import javax.jws.Oneway; import org.primefaces.event.SelectEvent; import beans.Car; @ManagedBean(name="forTest") @SessionScoped public class forTest implements Serializable { private List&lt;Car&gt; carList = new ArrayList&lt;Car&gt;(); private Car selectedCars[]; public Car[] getSelectedCars() { return selectedCars; } public void setSelectedCars(Car selectedCars[]) { this.selectedCars = selectedCars; } public List&lt;Car&gt; getCarList() { if(carList.size()==0) { setCarList(); } return carList; } public void setCarList() { this.carList.add(new Car(1, "car1")); this.carList.add(new Car(2, "car2")); this.carList.add(new Car(3, "car3")); } public void check(SelectEvent event) { System.out.println("in check"); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    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