<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -10,37 +10,48 @@ module ActiveOLAP::Helpers
     
       raise &quot;Only suitable for 2D cubes&quot; unless cube.depth == 2
       raise &quot;Only 1 aggregate supported&quot; if cube.aggregates.length &gt; 1
+      options[:strings] ||= {}
     
-      html = content_tag(:table, html_options.merge(:class =&gt; &quot;active-olap table 2d&quot;)) do    
+      content_tag(:table, html_options.merge(:class =&gt; &quot;active-olap table 2d&quot;)) do    
         content_tag(:thead) do
           content_tag(:tr, :class =&gt; 'category') do
-            content_tag(:th, '&amp;nbsp;') + &quot;\n\t&quot; +
+            header_html = content_tag(:th, '&amp;nbsp;') + &quot;\n\t&quot; +
             cube.dimensions[1].categories.map do |category|
               content_tag(:th, show_active_olap_category(category, :for =&gt; :matrix), :class =&gt; 'column', :id =&gt; &quot;category-#{category.label}&quot;)
             end.join
+            
+            if options[:totals]
+              header_html &lt;&lt; content_tag(:th, '&amp;nbsp;', :class =&gt; 'column total', :id =&gt; &quot;category-total&quot;)
+            end
+            header_html
           end
         end &lt;&lt; &quot;\n&quot; &lt;&lt;
         content_tag(:tbody) do
-          cube.map do |category, sub_cube|
-            content_tag(:tr) do
-              &quot;\t\n&quot; + content_tag(:th, show_active_olap_category(category, :class =&gt; 'category row', :id =&gt; &quot;category-#{category.label}&quot;, :for =&gt; :matrix)) + 
+          body_html = cube.map do |category, sub_cube|
+            content_tag(:tr, :class =&gt; 'row') do
+              row_html = &quot;\t\n&quot; + content_tag(:th, show_active_olap_category(category, :class =&gt; 'category row', :id =&gt; &quot;category-#{category.label}&quot;, :for =&gt; :matrix)) + 
               sub_cube.map do |category, value|
                 content_tag(:td, show_active_olap_value(category, cube.aggregates.first, value, :for =&gt; :matrix), :class =&gt; 'value')
               end.join
+              if options[:totals]
+                row_html &lt;&lt; content_tag(:td, show_active_olap_value(category, sub_cube.aggregates.first, sub_cube.sum, :for =&gt; :matrix), :class =&gt; 'value')
+              end
+              row_html
             end
           end
+          
+          if options[:totals]
+            body_html &lt;&lt; content_tag(:tr, :class =&gt; 'totals') do
+              &quot;\t\n&quot; + content_tag(:th, '&amp;nbsp;', :class =&gt; 'row total') + 
+              cube.transpose.map do |category, sub_cube|
+                content_tag(:td, show_active_olap_value(category, sub_cube.aggregates.first, sub_cube.sum, :for =&gt; :matrix), :class =&gt; 'value')
+              end.join + 
+              content_tag(:td, cube.sum, :class =&gt; 'value')
+            end
+          end
+          body_html
         end
       end
-      
-      if options[:totals]
-        html &lt;&lt; content_tag(:tr, :class =&gt; 'totals') do
-          &quot;\t\n&quot; + content_tag(:th, '&amp;nbsp;') + 
-          cube.map do |sub_cube, value|
-            content_tag(:td, show_active_olap_value(sub_cube.category, cube.aggregates.first, cube.sum, :for =&gt; :matrix), :class =&gt; 'value')
-          end.join
-        end
-        
-      end
     end
 
     def active_olap_table(cube, options = {}, html_options = {})</diff>
      <filename>lib/active_olap/helpers/table_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ebb2d893a18e848cba3b203530e4d8e0a26e4c48</id>
    </parent>
  </parents>
  <author>
    <name>Willem van Bergen</name>
    <email>willem@vanbergen.org</email>
  </author>
  <url>http://github.com/wvanbergen/active_olap/commit/8cd504a380ac370bd4bad715393d783eed4d1914</url>
  <id>8cd504a380ac370bd4bad715393d783eed4d1914</id>
  <committed-date>2009-10-10T01:47:17-07:00</committed-date>
  <authored-date>2009-10-10T01:47:17-07:00</authored-date>
  <message>Improved HTML table helper method.</message>
  <tree>258f2191e39c6a830b528f491a31ea03a386cf9c</tree>
  <committer>
    <name>Willem van Bergen</name>
    <email>willem@vanbergen.org</email>
  </committer>
</commit>
