Search code examples
jsf-2primefacesfacelets

Primefaces dataTable column width , color scheme , checkboxes functionality


I am new to primefaces and jsf and facing a few problems using it.

Following is the code i am using in jsf

<p:dataTable id="plazaId" var="plaza" value="#{coverageBean.plazaDataModel}" selection="#{coverageBean.selectedPlaza}" rowIndexVar="rowIndex" width="100%" border="0" cellspacing="0" cellpadding="0" >
            <p:column id="name" headerText="Select" selectionMode="multiple"
                    style="width:18px" />
            <p:column id="plazaName" headerText="Plaza's" style="width: 50%"  bgcolor="#dcdcdc">
                <h:outputText value="#{plaza.name}" bgcolor="#dcdcdc"></h:outputText>
            </p:column>
            <p:column id="plazaDirect" headerText="Directo" style="width: 10%"  bgcolor="#dcdcdc">
                <h:outputText value="#{plaza.direct}" bgcolor="#dcdcdc"></h:outputText>
            </p:column>
          </p:dataTable>

I have checked the Beans and backend. They are all correct.

The issues are :

  • I like to change the width using percentage in this table . But its not working.
  • I like all the rows to be of the same color. But its showing alternate colors (white and blue)
  • And is there a way to make the checkbox of simple html style . But its a little fancy.

Could anyone help with any of there problems. Thanks in advance


Solution

    1. As of today, this is not possible. Refer to http://code.google.com/p/primefaces/issues/detail?id=2801

    2. It is to do with styling. Define style as required.

    3. It is to do with styling. Define style as required.