Re: Newbie Question: Are HTML attributes always stripped for tables?
"Diez B. Roggisch" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Jacob Lauemøller wrote:
>Hi all,
>
>I have been experimenting a bit with Barracuda and have run into a problem. I
>have an HTML page looking somewhat like
>
><html>
> ...
> <table id="resultTable">
> <tr>
> <td align="center">Column A</td>
> <td align="right">Column B</td>
> </tr>
> </table>
>
></body>
>
>I have created a table model and attached a DefaulTableView to a BTable
>instance using this model. When I run my servlet, the table contents are
>replaced by the values present in the model (as expected) but the "align"
>attributes on the <td> elements are gone. What am I doing wrong?
>
>
Nothing. The BTable doesn't inspect your dom and draws conclusions out
of it. While this seems awkward, its actually a limitation that can't be
overcome. Lets say we have a table like the one you gave above. Now if
the TableModel contains three columns - which alignment do you want to
chose for the one column not specified?
My expirience is that usually the BComponents like BList, BTable and
alike are to somewhat limited use - which surely doesn't apply to
barracuda as a whole! Its just that the layout-concerns usually don't go
well with a purely data-driven approach like BTable.
Now of course there is a solution to this - use BTemplate! If you have
data organized in rows of fixed column size, its as easy as this:
<table id="resultTable">
<tr class="Dir::Iterate_Start.ModelName Dir::Iterate_Next.ModelName">
<td align="center"><span class="Dir::Get_Data.ModelName.ColA">Column A</span></td>
<td align="right"><span class="Dir::Get_Data.ModelName.ColB">Column B</span></td>
</tr>
<tr class="Dir::Iterate_End.ModelName Dir::Discard">
<td align="center">Column A</td>
<td align="right">Column B</td>
</tr>
</table>
Actually not much more to write, but full control over the layout here.
Regards,
Diez