Search code examples
htmljsfalignmentmyfaceshtml-table

JSF myfaces dataTable , how to avoid NBSP; tags in the TDs


I have style applied to the TD elements of the dataTable of my myfaces application.

td.financialReportTd {
    font-family: Arial;
    font-size: 12px;
    line-height: 12px;
    color:black;
    background-color: white;
        padding-right: 5px;
    text-align: right;
    border:0px black solid;
    height: 30px;
    padding-top:4px;
    padding-left:4px;
    vertical-align: top;
    direction: rtl;
}

Output:

<td class="financialReportTd">
    &nbsp;&nbsp;&nbsp;&nbsp;         
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          

    &nbsp;&nbsp;&nbsp;&nbsp;MY TEXT
</td>

No matter what I try, those NBSP tags fill up the TD and position of the text changes to the worse.

I tried style text-align:right; (I need RTL text), I tried direction: rtl; Nothing helps.

How can I align my text to the very right of the TD and avoid those space tags?


Solution

  • <h:column>
      ></h:panelGrid>
    </h:column>
    

    to eliminate NBSP, we need wrap the outputText into the panelGrid, plus (very important!) there should be NO sp happy :)