Details
-
Type:
Wish
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.0 RC2
-
Fix Version/s: TBD
-
Component/s: HTML Generation
-
Labels:None
Description
====
imported from sf tracker
id 1013562
submitted by Will Glass-Husain - wglass
http://sourceforge.net/support/tracker.php?aid=1013562
====
This patch adds a new tag <display:subRow> to
DisplayTag
The challenge: A number of times recently I've wanted
to make a table with multiple rows per item. Usually
there is one main row and several "sub-rows" (in the
same color) listing non-columnar information.
For example, the following table has 3 columns of data
about a person, but each row also has a secondary row
with a comment about the person going across the
whole row. (view in monospace font) .
---------------------------
| NAME AGE GRADE |
---------------------------
| Johnny 10 5 |
| -has trouble reading. |
|--------------------------|
| Emily 10 5 |
| -spends too much time |
| daydreaming |
|--------------------------|
| Albert 10 5 |
| -smart kid but goofs off |
----------------------------
It is possible to create such rows with a
TableDecorator, but this forces the unpleasant
challenge of encoding the specific HTML for the
secondary row in the Java class itself. A unique
TableDecorator must also be created for every type of
row. It's close to impossible to display row-specific info
since the TableDecorator is called after the iteration
over the record objects is complete.
As an alternative, <display:subRow> is an easy way to
add one or more rows above or below each list row. By
specifying CSS styles that eliminate the upper border for
a row, the multi-row block for a record can look like one
contiguous row.
Example:
<display:table id="row">
<display:column title="Name" property="name"/>
<display:column title="Name" property="age"/>
<display:column title="Name" property="grade"/>
<display:subRow oddClass="odd_subrow"
evenClass="even_subrow"
positionBelow="true">
<td colspan="3">
<c:out value="${row.comment}"/>
</td>
</display:subRow>
</display:table>
This is an elegant way to specify additional information
about a record that doesn't neatly fit into columnar
format.
The attached patch is in unified diff format, and is
based on displayTag 1.0rc2 snapshot. I tried to follow
existing coding guidelines but let me know if you've any
suggestions for reformatting.
I welcome any comments.
====
Date: 2004-08-22 00:01
Sender: wglass
Logged In: YES
user_id=643158
Just a quick correction re: my complaint on TableDecorator.
Yes, you can display row-specific info with
getCurrentRowObject. I had trouble with related issues not
worth discussion in this forum. Regardless, I think a new tag
for this purpose is a better approach.
imported from sf tracker
id 1013562
submitted by Will Glass-Husain - wglass
http://sourceforge.net/support/tracker.php?aid=1013562
====
This patch adds a new tag <display:subRow> to
DisplayTag
The challenge: A number of times recently I've wanted
to make a table with multiple rows per item. Usually
there is one main row and several "sub-rows" (in the
same color) listing non-columnar information.
For example, the following table has 3 columns of data
about a person, but each row also has a secondary row
with a comment about the person going across the
whole row. (view in monospace font) .
---------------------------
| NAME AGE GRADE |
---------------------------
| Johnny 10 5 |
| -has trouble reading. |
|--------------------------|
| Emily 10 5 |
| -spends too much time |
| daydreaming |
|--------------------------|
| Albert 10 5 |
| -smart kid but goofs off |
----------------------------
It is possible to create such rows with a
TableDecorator, but this forces the unpleasant
challenge of encoding the specific HTML for the
secondary row in the Java class itself. A unique
TableDecorator must also be created for every type of
row. It's close to impossible to display row-specific info
since the TableDecorator is called after the iteration
over the record objects is complete.
As an alternative, <display:subRow> is an easy way to
add one or more rows above or below each list row. By
specifying CSS styles that eliminate the upper border for
a row, the multi-row block for a record can look like one
contiguous row.
Example:
<display:table id="row">
<display:column title="Name" property="name"/>
<display:column title="Name" property="age"/>
<display:column title="Name" property="grade"/>
<display:subRow oddClass="odd_subrow"
evenClass="even_subrow"
positionBelow="true">
<td colspan="3">
<c:out value="${row.comment}"/>
</td>
</display:subRow>
</display:table>
This is an elegant way to specify additional information
about a record that doesn't neatly fit into columnar
format.
The attached patch is in unified diff format, and is
based on displayTag 1.0rc2 snapshot. I tried to follow
existing coding guidelines but let me know if you've any
suggestions for reformatting.
I welcome any comments.
====
Date: 2004-08-22 00:01
Sender: wglass
Logged In: YES
user_id=643158
Just a quick correction re: my complaint on TableDecorator.
Yes, you can display row-specific info with
getCurrentRowObject. I had trouble with related issues not
worth discussion in this forum. Regardless, I think a new tag
for this purpose is a better approach.