Hiding Totals In Categorized Web View
If you have a categorized view, shown to browsers, that includes totals, how can you prevent the overall total row from appearing? It's actually not that complicated - you just have to think about how Domino generates the HTML for views. But the first question would be "why would you want to do that?" Let me give you an example. Assume you have a view categorized by the month of the year. You have a column in this view that shows totals. Your users don't care about the overall totals for the entire year, but do care if they are meeting their quotas on a month-to-month basis. So, on the web, you want to show the totals for each month, but not for the entire year. So you want to show this categorized view but hide the last row where the totals appear.
You should add two new columns to your view - one at the very start (1st column - before the categorized column) and one at the very end. The column at the very end will open up an HTML comment to be sent to the browser. So the column value should be:
"[<!--<b></b>]"
The reason for the open/close bold tags at the end is so we can end the pass-through HTML properly. Domino needs the right bracket to appear right after a greater than sign in order to stop the pass-through HTML. So we make sure that is available by opening and closing some tag (bold is chosen, but any tag would work).
Why did we do that? The last row of the view, where the totals appear, is out of our control. None of the columns to the left of the total column has any data, and that's by design - we can't put anything in there. So, we open up an HTML comment. The 2nd to last row in the view will open up the HTML comment which will comment out the totals row, preventing it from being hidden.
But what about all the other rows? We need the other rows to show. So that's what the first column is going to do - close out that HTML comment so the first row will show. But think about what we actually commented out. Domino's generation of the close cell, close row, open row (on the next document) and open cell (on the first column of the next document) were all commented out before we even have a chance to do anything. So we'll need to take care of that in the column formula of the first column:
"[<b></b>--></td></tr><tr><td>]"
So, this column this time needs to open up pass-through HTML, then close out the HTML comment, close out the previous cell and previous row, then open up the new row and new cell.
What about the first row? The first row in the view is going to try and close out an HTML comment, so an HTML comment needs to be open before the view is displayed. This is most easily done in the view template. Normally, in this type of a view, we will hide the column headers and build them ourselves. If you want, your last column header can open up the HTML comment for the first row to close, but then you're not being 100% XHTML compliant. Domino generates TH tags for the headers and we're closing out a TD tag. Forgiving browsers will overlook that, but we usually put our table headers in the view template. Then, right before the $$ViewBody field, we open up an HTML comment. This takes care of the first row.
What about the last row? The HTML comment opened in the last row before the totals is never closed. Which is what we want, because the totals will be hidden. But in the view template, we need to close out that comment before doing anything else. So after the $$ViewBody field, the HTML comment tag is closed. This would be needed even if you decide to use the column header on your last column to open up the comment for the first row to close. So a view template is going to be needed anyway, which is another reason why we just include the headers in the template.