[ 
http://jira.codehaus.org/browse/DISPL-565?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=153301#action_153301
 ] 

Todd Hansberger commented on DISPL-565:
---------------------------------------

I had the exact same problem trying to figure this out, and finally I 
downloaded the source code, created my own sub-class of TotalTableDecorator, 
overrided a few methods to debug them, and this is what I found:

The only time a grand total label will display is if there is a column defined 
with a group = 1, so I set one of my <display:column> tags to have a group 
attribute of "1" (which does not even need to be grouped).  However, doing that 
not only showed the total label, but it also added subtotal rows for my grouped 
column, which I didn't want.

In order to remove the subtotal rows, I sub-classed TotalTableDecorator like so:

<code>
public class GrandTotalOnlyDecorator extends TotalTableDecorator
{
   public GrandTotalOnlyDecorator()
   {
      super.setTotalLabel("Total"); // set this to whatever you want, it 
defaults to "Total"
   }

   protected String createTotalRow(boolean grandTotal)
   {
      if(grandTotal)
      {
         return super.createTotalRow(grandTotal);
      }

      return "";
   }
}
</code>

Then in the &lt;display:table&gt; tag, set the decorator attribute to the full 
class name of your sub-class above.  I sure hope there is an easier way to do 
this.

> Total label not being displayed when using TotalTableDecorator
> --------------------------------------------------------------
>
>                 Key: DISPL-565
>                 URL: http://jira.codehaus.org/browse/DISPL-565
>             Project: DisplayTag
>          Issue Type: Bug
>          Components: Decorators
>    Affects Versions: 1.1.1
>            Reporter: Wilson
>             Fix For: 1.1.1
>
>
> After many tries I have not been able to show the Total label  when using 
> TotalTableDecorator to show the total value of a column. The total value is 
> displayed properly, but not the label. I have also tried this
> <jsp:scriptlet>
>      org.displaytag.decorator.TotalTableDecorator totals = new 
> org.displaytag.decorator.TotalTableDecorator();
>      totals.setTotalLabel("Full Total");
>      pageContext.setAttribute("totals", totals);
>   </jsp:scriptlet>
> and then added  decorator="totals" to my table, but only the value is shown, 
> not the label.
> Thank you!

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
displaytag-devel mailing list
displaytag-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-devel

Reply via email to