Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I adjust width of <p:column> in <p:panelGrid>?

Tags:

primefaces

I used width attribute as for all columns but In display, columns are not adjusted.

Can i get in this way? If, please guide me to achieve column widths as I desired.

like image 647
swaps Avatar asked Mar 25 '13 05:03

swaps


2 Answers

you must to use columnClasses attribute and separate every column style with comma(,). the code examples below show how to use columnClassess attribute.

in head tag:

<style type="text/css">
            .column1{width: 10px;height:auto}
            .column2{width: 5px;height:auto}
            .column3{width: 20px;height:auto}
           </style>

in body tag:

<p:panelGrid columnClasses="column1,column2,column3" columns="4" style="width: 100%" >  
                    <p:column></p:column>                        
                    <p:column></p:column>
                    <p:column></p:column> 
                    <p:column></p:column> 
                </p:panelGrid>  

it is works with h:panelGrid tag too.

like image 72
Ebrahim Amini Sharifi Avatar answered Jan 03 '23 14:01

Ebrahim Amini Sharifi


you can either use a hard coded value:

<p:column style="width:20px">

or a percentage :

<p:column style="width:20%">

depending on what suits you best.

like image 37
pantominas Avatar answered Jan 03 '23 14:01

pantominas