In my last post I showed you how to add totals to your views programmatically.
Having the totals created, I’ve added a few items to my list that looks like this now:
As you can see, totals are displayed at the top of the view. That is really not the same the users got used to in Excel (or in the case of paper based tables), where aggregations usually displayed at the bottom of the sheet. So it is not a surprise that customers often request us to move the totals to the bottom of the view.
I wish all requirement would be so easy to implement!
In a former post I showed you how to create customized versions of the main.xsl and vwstyles.xsl files to alter view rendering. If you are ready with cloning that files and set the view in SharePoint Designer to use the new the main.xsl as described in that post, open the copy of the vwstyles.xsl and look for the comment:
<!– total first –>
The first occurrence you find is within a template:
<xsl:template match="View[ViewStyle/@ID='14']" mode="RenderView">
Find the second one that is in this template:
<xsl:template match="View" mode="RenderView">
Cut the following block:
and paste it to the end of the template block. I suggest to replace the word first to last in the text of the comment.
Save the file and run IISRESET if the customized vwstyles.xsl was already loaded by SharePoint.
The following screenshot shows the result: