Re: Newbie Question: Are HTML attributes always stripped for tables?
Jacob Lauemøller <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <[email protected]> |
Diez,
Thank you for your super-quick answer (impressed!).
Ok, this was sort of what I had figured out from reading the documentation
etc. and looking at the source. Just wanted to make sure. I will give the
template approach a spin but personally do not like have directives in the
HTML page (I'm aware that I can keep a separate mapping file but in my opnion
this seems to result in a more brittle application and somewhat dilutes the
non-intrusive approach that makes XMLC so attractive.)
It would seem to me that BTable could have used default attributes (i.e. none)
for the columns not defined in the HTML and then simply retain any attributes
specified for the defined columns. This would have been more in line with how
I would have coded an XMLC-only approach; cloning the existing row and
substituting values into it.
So, I could have
<html>
...
<table id="resultTable">
<tr>
<td id="columnA" align="center">Column A</td>
<td id="columnB" align="right">Column B</td>
</tr>
</table>
</body>
TableModel could then have had a method
Object getValueAt(int row, String column)
which would have worked, in my opinion, just as well (with the provision that
the table fill is not HTML driven rather than model driven.)
Kind regards,
Jacob
On Tuesday 12 August 2003 13:32, Diez B. Roggisch wrote:
> 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
>
> _______________________________________________
> Barracuda mailing list
> [email protected]
> http://barracudamvc.org/lists/listinfo/barracuda