Skip to main content link. Accesskey S
  • Log In
  • Help
  • IBM Logo
  • IBM Web Experience Factory wiki
  • All Wikis
  • All Forums
  • Home
  • Product Documentation
  • Community Articles
  • Learning Center
  • IBM Redbooks
Community Articles Product Documentation Learning Center IBM Redbooks This category Web Experience Factory 8 Documentation WebSphere Portlet Factory 7 Documentation WebSphere Portlet Factory 7.0.1 Documentation Custom Search Scope...
Search
Community Articles > Web Experience Factory > Samples and Techniques for Web Experience Factory > Expand/Collapse Without Collapsible Section or Category View
  • New Article
  • Share Show Menu▼
  • Subscribe Show Menu▼

About the Original Author

Martin T Romano
Contribution Summary:
  • Articles authored: 4
  • Articles edited: 4
  • Comments Posted: 1

Recent articles by this author

Expand/Collapse Without Collapsible Section or Category View

h3 Overviewh3 The Collapsible Section and Category View builders perform some nice automation for you, but sometimes you want more control andor the ability to work around limitations in these builders. It turns out that building a collapseexpand UI using base Portlet Factory builders is ...

Accessing Variables From JavaScript

There are a number of techniques that can be used to access the values of serverresident variables or methods from clientside JavaScript code. These techniques fall into two main categories: embedding variable values in script code as the page is being rendered using an Ajaxlike call to fetch ...

Page Tabs With Close Buttons

h2 Overview h2 br This sample shows a techique for modifying the output of the Page Tabs builder to add a button to each tab that can "close" that tab, along with a way to restore all closed tabs. Here's a picture of the model in action: br {{pic1.gif Screenshot of the Output of ...

Techniques for building a controller model using Model Container and events

h2 Background information h2 br This sample demonstrates a number of techniques that can be helpful when building a model that uses multiple child models using the Model Container builder. br Sample description br The attached package includes a master modelportlet ...

Community articleExpand/Collapse Without Collapsible Section or Category View

Added by Martin T Romano | Edited by Keshi Dai on August 2, 2010 | Version 11
  • Edit
  • More Actions Show Menu▼
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars
expanded Abstract
collapsed Abstract
No abstract provided.
Tags: Code samples, User Interface

Overview

The Collapsible Section and Category View builders perform some nice automation for you, but sometimes you want more control and/or the ability to work around limitations in these builders. It turns out that building a collapse/expand UI using base Portlet Factory builders is pretty easy, and doing so can allow you to add features not present in the higher-level builders.


General Approach


The basic approach to building an expandible display includes the following:
    • maintaining a data structure to track which sections are expanded
    • assigning a unique ID to each section
    • inserting an icon which will change depending on the expansion state of the associated section
    • using Visibility Setters to hide collapsed section contents; alternatively, the CSS display attribute can be used for a pure-client approach
    • adding a Link builder to connect the icon and section header to a "toggle visibility" action that updates the data structure and refreshes the page, or part thereof

"Only One Expanded Section" Example


Sometimes one would like to have a series of expandable sections where expanding one section would collapse all other expanded ones. This is not directly possible using Collapsible Section or Category view, but a manual approach is straightforward. In particular, the "data structure" from the general approach can just be a single item variable. The "ManualCollapse_OnlyOneExpanded" example shows this implmentation in action:


 Screen shot of


You can download this sample here.


Multiple-Level Expand/Collapse


Collapsible Section does not always work smoothly with multi-level, repeated data, where some expandible sections are contained inside others. The attached example shows how to use some of the basic techniques from the previous example to build a hierarchical expandable display. The general approach above can be used to enable multiple levels of expand/collapse regions, using a Java Set object to hold the list of expanded sections. The "ManualCollapse_NestedRepeats" sample demonstrates one way to implement this requirement.
 
 Screen shot of 

This model uses a base model which it pulls in using Imported Model; this base model is responsible for creating the basic outline or hierarchical display, using three nested Repeated Regions, while the ManualCollapse_NestedRepeats model adds the necessary builder calls to create the expand/collapse display.


You can download this sample here.


Manual Category View


Building a model that behaves like Category View without Category View is a bit more difficult, but still quite doable. The basic approach above applies, but is made a bit more complex by the necessity to maintain a page automation tabular structure while adding category rows with specific visibility. The ManualCategoryView sample builds a UI that works similar to that made by Category View, while adding the ability to do partial-page refresh.


 Screen shot of 


This sample can be downloaded here.

  • Edit
  • More Actions Show Menu▼


expanded Attachments (5)
collapsed Attachments (5)
Edit the article to add or modify attachments.
File TypeSizeFile NameCreated On
application/x-zip 9 KB ManualCategoryView.zip 12/10/08 2:08 PM
application/x-zip 5 KB ManualCollapseExpandSingle.zip 12/10/08 2:08 PM
image/jpeg 73 KB pic1.jpg 12/10/08 2:08 PM
image/jpeg 69 KB pic2.jpg 12/10/08 2:08 PM
image/jpeg 114 KB pic3.jpg 12/10/08 2:08 PM
expanded Versions (11)
collapsed Versions (11)
Version Comparison     
VersionDateChanged by              Summary of changes
This version (11)Aug 2, 2010 10:09:41 AMKeshi Dai  
10Jan 15, 2010 5:15:19 PMRob Flynn  IBM contributor
9Dec 22, 2009 2:38:04 PMRob Flynn  IBM contributor
8Dec 22, 2009 2:36:47 PMRob Flynn  IBM contributor
7Dec 11, 2008 4:24:32 PMMartin T Romano  IBM contributor
6Dec 11, 2008 4:19:17 PMMartin T Romano  IBM contributor
5Dec 10, 2008 2:54:41 PMMartin T Romano  IBM contributor
4Dec 10, 2008 2:50:55 PMMartin T Romano  IBM contributor
3Dec 10, 2008 2:46:21 PMMartin T Romano  IBM contributor
2Dec 10, 2008 2:23:43 PMMartin T Romano  IBM contributor
1Dec 10, 2008 2:08:40 PMMartin T Romano  IBM contributor
expanded Comments (0)
collapsed Comments (0)
Copy and paste this wiki markup to link to this article from another article in this wiki.
Go ElsewhereStay ConnectedHelpAbout
  • IBM Collaboration Solutions wikis
  • IBM developerWorks
  • IBM Software support
  • Twitter LinkIBMSocialBizUX on Twitter
  • BlogsIBMSocialBizUX on Facebook
  • ForumsLotus product forums
  • BlogsIBM Social Business UX blog
  • Community LinkIBM Collaboration Solutions
  • Wiki Help
  • Forgot user name/password
  • Wiki design feedback
  • Content feedback
  • About the wiki
  • About IBM
  • Privacy
  • Accessibility
  • IBM Terms of use
  • Wiki terms of use