Custom formatting for SharePoint lists using FlexListViewer-webpart
FlexListViewer-webpart can be used to display lists of other sites. It does so by reading the contents of the view of the remote list, storing it into a small object-model, serialize it to an XML-stream and transform it to HTML using an xslt.
The stylesheet (xslt) was created to make the list look as must as a regular SharePoint-list as possible. However, sometimes you may desire the list, or possible a column of the list, to be displayed differently. Say you have a list containing all projects that are currently active. For each project you specify its status (good, average, poor), but when viewing the list on the frontpage of you site/area, you don’t want to display “Good“, but you want to render a green image (or a red image when the project’s status is poor). This would look like this:
Out-of-the-box that is only possible by using FrontPage to convert the standard ListViewer-webpart to xslt. Since that would make the page unghosted (an we don’t want that), FlexListViewer would be an alternative. You could modify the xslt it uses, or specify a different xslt.
Because the image is automatically rendered, the project manager that edits the list, can still use the standard form for the list:
To configure FlexListViewer-webpart to support this custom formatting for the column ‘status’, you will have to create a new xslt by copying the original (usually at C:Program FilesCommon FilesMicrosoft Sharedweb server extensionswpresourcesFlexListViewer…) and add logic for the custom formatting (like this). To make it available to FlexListViewer-webpart, you can upload the xslt into a document library on your site. Next you have to configure FlexListViewer-webpart to use the custom xslt by specifying the FULL URL to the xslt.
Because you may want to supply some additional information to the webpart, you can use the “Parameters“. In the example above Param1 and Param2 are used to supply the webpart the display-name of the status-column and the name of the document library that contains the status-images.
To get this running quickly, you can download list-templates for the document library containing the images and the custom xslt and a template for the Project-Status list (both for English WSS-sites).
A new version of the FlexListViewer-webpart is available: v1.5.
It contains several bugfixes and new features:
- Support for LookUp-fields (already available with v1.1)
- Support for Parameters (for xslt)
- Nicer errormessages
Download FlexListViewer 1.5 1.6 >>here<<! (Updated, check here!)
(Robert te Kaat)