how to freeze columns of my choice in prime Faces data table?

I search many of sites but I didn't get how to freeze the first two columns and last two columns in prime faces data Table it has option of frozenColumn="i" but in this we can freeze only sequentially. for example i=2 will freeze first 2 columns and i=3 will freeze first 3 columns. I am using prime faces 6.2 and jsf 2

             <p:dataTable var="test" value="#{obj.list}" 
                             emptyMessage="No data found" scrollWidth="500" scrollHeight="300" 
                             id="datatable" frozenColumns="2" resizableColumns="true" scrollable="true" >

                    <p:column headerText="header1" footerText="header1" class="col2" >
                        <h:outputText  value="data1"/>
                        <p:graphicImage style="display:none"/>
                    </p:column>

                    <p:column headerText="header2" footerText="header2" class="col2">
                        <h:outputText  value="data2"/>
                        <p:graphicImage style="display:none"/>
                    </p:column>

                    <p:column headerText="header3" footerText="header3" class="col2">
                        <h:outputText  value="data3" />
                    </p:column>

                    <p:column headerText="header4" footerText="header4" class="col2">
                        <h:outputText value="data4" />
                    </p:column>

                    <p:column headerText="header5" footerText="header5" class="col2">
                        <h:outputText    value="data5"/>
                    </p:column>

                    <p:column headerText="header6" footerText="header6" class="col2">
                        <h:outputText  value="data6" />
                    </p:column>

                   
                </p:dataTable>

i want to freeze first two columns and last two columns

Upvotes: 1

Views: 2341

Answers (1)

Jasper de Vries
Jasper de Vries

Reputation: 20263

That's not possible according to the DataTable frozenColumns documentation:

Specific columns can be fixed while the rest of them remain as scrollable. frozenColumns defines the number of columns to freeze from the start.

You can always add a feature by opening pull request at the PrimeFaces GitHub repository, or check the support options.

Upvotes: 1

Related Questions