Really the fundamental issue has little to do with the dataTable itself.  It
has more to do with specifying justifications for different types of data,
within the same table.  UI layout in JSF is very klugey.  Here is a simple
table with two columns and two rows.

<table border="1">
        <tr>
                <th>Today's Date</th>
                <th>Current Weather</th>
        </tr>
        <tr>
                <td align="right">11/15/2006</td>
                <td>Sunny</td>
        </tr>
</table>

As you can see, the first column in the second row needs to be right
aligned, becasue it's a date.

Now, so far as I know, here is (roughly) the way this same table would be
represented in JSF:

<h:panelGrid columns="2">
        <h:panelGrid style="text-align: center" columns="2">
                <h:outputText value="Today's Date"/>
                <h:outputText value="Current Weather"/>
        </h:panelGrid>
        <h:panelGrid style="text-align: right" columns="1">
                <h:outputText value="#{myBean.todaysDate}"/>
        </h:panelGrid>
        <h:panelGrid columns="1">
                <h:outputText value="#{myBean.weather}"/>
        </h:panelGrid>
</h:panelGrid>

There must be something better than this.  Do I really need to create a new
table (<h:panelGrid>) everytime a style attribute changes across columns? 
Is this the extent of control we have over finite rendering points?





Scott Stevenson-5 wrote:
> 
> Maybe I'm missing the point but why would you want to use a columns tag
> without a datatable??
> 
> The answer is, you can't (as far as I know).
> 
>>
>> Can I use <t:column>without using <dataTable>?
>>
>>
>> Scott Stevenson-5 wrote:
>>>
>>> In your column (or columns) tag simply specify a style to align the text
>>> contained in that column.  We use something like this in our <t:columns>
>>> tag:
>>>
>>> style="text-align:#{dataTableBean.alignment};"
>>>
>>> Where getAlignment() in the backing bean returns "left", "right" or
>>> "center" depending on the current column.
>>>
>>> If you are using a <t:column> tag then you can explicity set the style
>>> like this:
>>>
>>> style="text-align:RIGHT;"
>>>
>>>
>>>>
>>>> I have 1 row of 10 fields, with respective column headers, which I need
>>>> to
>>>> display in a two-row table.  Some fields are strings and some are
>>>> numbers
>>>> and dates.  Applying typical justification rules, I need to right
>>>> justify
>>>> dates and numbers and left justify the Strings.  I have come to the
>>>> conclusion that I can't use <h:dataTable>.  The question is, how do I
>>>> get
>>>> the ability to specify justification without the use of <h:dataTable>?
>>>>
>>>> It may be my ignorance but I'm finding JSF view rendering unecessarily
>>>> restrictive, when something like this should be allowed (or at least
>>>> configurable).  HTML nested in <f:verbatim> doesn't seem to render
>>>> properly
>>>> when there are JSF tags (<h:outputText/>) nested within.
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/text-align%3A-center---without-%3Ch%3AdataTable%3E-tf2631645.html#a7344409
>>>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/text-align%3A-center---without-%3Ch%3AdataTable%3E-tf2631645.html#a7359717
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/text-align%3A-center---without-%3Ch%3AdataTable%3E-tf2631645.html#a7365614
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to