XPages Data Views – Part 9: Multi-Column Layout
Another great feature of the Data View control is its ability to easily provide a multiple-column layout. In this post, I’ll show you can use that property to let the user dynamically determine the number of columns to display.
Data View Series
- Part 1 – Overview
- Part 2 – Creating a Data View
- Part 3 – Collapsible Details
- Part 4 – Icon Columns
- Part 5 – Pager Add Rows Control
- Part 6 – Pager Save State Control
- Part 7 – Customized Summaries
- Part 8 – Sorting and Filtering
Multiple Column Layout
If your data lends itself to a multiple-column layout (e.g. a business card-style display), you can easily achieve this by setting the multiColumnCount property of the Data View. (All Properties > format > multiColumnCount)
You can still expand/collapse detail sections when multiple columns are used.
Giving the user control
Taking this a step further, you can compute the property and give the user the ability to adjust the display as desired.
The steps are virtually the same as shown in the last post on sorting and filtering.
1) Put a combobox on the page with options for the number of columns to display. (You can event put it in one of the pager top facets of the data view to tie it in.)
2) Bind the combobox to a sessionScope variable
3) Set the onchange event of the combobox to trigger a partial refresh on the data view
4) Compute the Sort column property to return that sessionScope variable