Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Primefaces data table Row selection and multiple checkbox selection not working

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>
like image 591
Jerry Avatar asked Jun 26 '13 05:06

Jerry


2 Answers

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" />
like image 163
Suresh Kumar Pathak Avatar answered Sep 17 '22 18:09

Suresh Kumar Pathak


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

like image 43
Prasad Kharkar Avatar answered Sep 21 '22 18:09

Prasad Kharkar