How can I remove the Page SUM
row in my Views Calc?
I have upgraded Views Calc module to its latest version.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.
Sign up to join this communityHow can I remove the Page SUM
row in my Views Calc?
I have upgraded Views Calc module to its latest version.
You can achieve this in two ways
1) Add following style in your CSS
tr.view-subfooter-number{ display: none; }
OR
2) Go to views-calc-table.tpl.php file under views_calc module directory and find the following code (PAGE SUM row code)
<tr class="view-subfooter-number">
<?php foreach ($row as $field => $content): ?>
<td class="view-subfooter views-field views-field-<?php print $fields[$field]; ?> <?php print $options['info'][$field]['align'] ?>">
<?php print $content; ?>
</td>
<?php endforeach; ?>
</tr>
You can comment/remove the above code to hide 'PAGE SUM' row at view output.
As the page sum is used with the pager, therefore it should really only appear when using a pager so:
copy the views-calc-table.tpl.php
to your theme folder and edit the footer part to :
<tfoot>
<?php if ($view->query->pager->plugin_name != 'none' ): ?>
<?php foreach ($sub_totals as $type => $row): ?>
<tr class="view-subfooter-number">
<?php foreach ($row as $field => $content): ?>
<td class="view-subfooter views-field views-field-<?php print $fields[$field]; ?> <?php print $options['info'][$field]['align'] ?>">
<?php print $content; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<? endif; ?>
<?php foreach ($totals as $type => $row): ?>
<tr class="view-footer-number">
<?php foreach ($row as $field => $content): ?>
<td class="view-footer views-field views-field-<?php print $fields[$field]; ?> <?php print $options['info'][$field]['align'] ?>">
<?php print $content; ?>
</td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
</tfoot>
the line if ($view->query->pager->plugin_name != 'none' ):
means that it shows the page sum row only the views uses one of the pager plugins.
This way you are not relying on CSS and you can still use the page sum row when using a pager.
td.view-subfooter{ display: none; }
– noob Apr 11 '14 at 7:18