19
votes

I am using primeface 3.5 where i find the check box to select and unselect or row select work perfectly independently . While I tried to have both the row selection and check box selection ,row selection event is not triggering . Could any one clarify this for me ?

row select is not working thou check all event is working

<p:dataTable id="myBookDTable" var="car" value="#{myBean.pageViews}" paginatorPosition="bottom" paginator="true" rows="30" scrollable="true" scrollHeight="400" scrollRows="30" paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}" rowsPerPageTemplate="30,50,100"rowKey="#{car.carID}" rowIndexVar="rowIndex" draggableColumns="true" lazy="true">

<p:ajax event="rowSelect" listener="#{myBean.onRowSelect}" update="certainpart"
                                async="true"/>
<p:ajax event="rowSelectCheckbox" listener="#{myBean.rowSelectCheckbox}"/>
<p:ajax event="rowUnselectCheckbox" listener="#{myBean.rowUnselectCheckbox}"/>

<p:ajax event="rowUnselect" listener="#{myBean.rowUnselect}"/>

<p:column  width="30" selectionMode="multiple" style="width:2%" />

</p:datatable>
3
What is the problem you are facing?Prasad Kharkar
Please post your code and exact problem you are facingPrasad Kharkar
are you sure the problem only occurs when you are using them both?No Idea For Name
@LiranElisha : YES ,i am facing the problem only while using bothJerry

3 Answers

24
votes

For column header event we have a different header name exist in primeface/jsf: "toggleSelect". You can use like this:

<p:ajax event="toggleSelect" update="@this" process="@this" />
22
votes

In your datatable tag, Use this

   <p:ajax event="rowSelectCheckbox" update="someComponent" />
  <p:ajax event="rowUnselectCheckbox" update="someComponent" />
  <p:ajax event="rowSelect" update="someComponent" />
  <p:ajax event="rowUnselect" update="someCompoent" />
  <p:column selectionMode="multiple" style="width:4%" />

you need to fire these four ajax events and make sure you make the column selectionMode as multiple

3
votes

Try this:

<p:ajax event="toggleSelect" update=":form:component" partialSubmit="true" />

The source:

PrimeFaces 4.0 User Guide.- Ajax Behavior Events