Hey Coop,

I think you've made a good start of it.

Iterate over each column child.   If it's rendered, add it to the count.
If it's rendered and is a t:columns component, add
columns.getRowCount() [which is functionally getColumnCount).

Once you've got this tested and working, open a JIRA issue and attach a patch.

Thanks!


On 3/16/07, Cooper, Stephen <[EMAIL PROTECTED]> wrote:




Hi all – I have discovered what I think is a bug with the renderDetailRow
method in HtmlTableRenderer.

Basically, I have a table which has both a variable number of columns, and
also a detailStamp.  What I noticed was that when expanding the detail
stamp, it didn't occupy the same width as the enclosing table.  E.g. if the
main table had six columns in it, where two columns were of the <t:column>
variety and the remaining four columns were rendered via <t:columns>, then
the colspan of the detailStamp was only three – one for each of the
<t:column> and one for the <t:columns>.



I noticed on line 146 of HtmlTableRenderer that it does this:
writer.writeAttribute(HTML.COLSPAN_ATTR,new
Integer(uiData.getChildren().size()) ,null);




I.e. it makes a colspan which spans the number of children of the containing
uiData.  This doesn't take into account a) <t:columns> rendering more than
one <td> and it also doesn't take into account any rendered='false'
children.



That second point allows me to work around the issue by putting a number of
<t:column rendered='false'/> columns in my table.  J



I was able to spot the bug, but I don't know what method to call to get an
accurate count of rendered <td> elements.  Perhaps someone more
knowledgeable than in this area can commit a fix?



Thanks!

Coop


Reply via email to