Usability - Productivity - Business - The web - Singapore & Twins

Add a "Collapse All" button/link to your categorized view

Quick tip for today. The XPages View control allows to display categorized views. While I don't like them in web applications one still wants to use them. In the Notes client categorized views have a handy "expand all" / "collapse all" SmartIcon pair which is missing in XPages. The shortest way to get these is to add an output script to your page:
XSP.attachPartial("#{id:viewColumn1}__shrink:1", "#{id:collapseAllElement}", "#{id:viewPanel1}", "onclick", function(){}, 0, "#{id:viewPanel1}_OUTER_TABLE");
You need to adjust the names in bold red. Works like a charm. Left to the reader: figure out the command for Expand all (or create a toggle control).
As usual YMMV.

Posted by on 20 April 2011 | Comments (5) | categories: XPages


  1. posted by Patrick Kwinten on Wednesday 20 April 2011 AD:
    Categorized views make Notes a bit 'unique' but since most other systems don't use them I rather avoid to use them.
  2. posted by Ian Randall on Wednesday 20 April 2011 AD:
    Categorized Views are really useful when the same document falls into multiple categories, but many users get confused by this.

    A flat view in contrast is more familiar to many users, but is hopeless at dealing with the situation where the same document appears in multiple categories.

    Categorized views are best used when users don't have deletion rights to documents, which is where their confusion can damage data integrity.
  3. posted by Stephan H. Wissel on Wednesday 20 April 2011 AD:
    Patrick, Ian: there are 2 parts to it:
    1. using a categorized view in development: absolutely
    2. showing a categorized view: not my taste (as outlined previously)
    So as a data construct it is very useful, one just needs to build a different UI metaphor for it.
    Emoticon biggrin.gif stw
  4. posted by Stephan H. Wissel on Saturday 20 April 2013 AD:
    @Brent -> that a reason to use them - but you still don't need to show twisties. I use categorized views as source for graphics - very neat
  5. posted by Brent Madsen on Saturday 20 April 2013 AD:
    Categorized views are very useful when they show totals (and sub-totals) for categories containing numerical data.