Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove select all check box in Primefaces datatable

Is there a way to remove the select all check box on the header of the p:datatable.

I need check box on the individual row but not on the header.

like image 558
KCP Avatar asked May 07 '13 17:05

KCP


2 Answers

This works very well :

.ui-chkbox.ui-chkbox-all.ui-widget {
    display:none !important;
 }
like image 148
Debutantjsf Avatar answered Sep 21 '22 15:09

Debutantjsf


I managed to do this by using p:columnGroup for specifying headers.

 <p:dataTable id="selectByPotentialTable" var="replacementByPotential"
    widgetVar="selectByPotentialTable"
    value="#{kmSelectByPotentialBean.allReplacementPrintersViewModel}"
    selection="#{kmSelectByPotentialBean.selectedByPotentialReplacement}">

        <p:columnGroup type="header">
            <p:row>
               <p:column/>
               <p:column headerText="Printer Model"/>
            </p:row>
        </p:columnGroup>
        <p:column selectionMode="multiple" style="width:2%;text-align:center"/>
        <p:column>
            #{replacementByPotential.name}
        </p:column>

</p:dataTable>

If you change your mind and you want the selectAll checkbox to be displayed, you need to change

<p:columnGroup type="header">
        <p:row>
        <p:column/>
           <p:column headerText="Printer Model"/>
        </p:row>
</p:columnGroup>

to

<p:columnGroup type="header">
        <p:row>
           <p:column selectionMode="multiple" style="width:2%;text-align:center"/>
           <p:column headerText="Printer Model"/>
        </p:row>
</p:columnGroup>
like image 31
Zhenya Avatar answered Sep 18 '22 15:09

Zhenya