Customize the rendering of a List View in Sharepoint 2010: Displaying List Items in Accordion

Overview

The creation of non standard presentations for Lists/Libraries  is a fairly common  scenario and using the XSLT List View Web Part (XLV) possibilities that can be achieved pretty easily.
Let’s take a look how to render list of question and answers using Accordion Menu in SharePoint. Actually the idea for this post appeared after posting  of corresponding question on StackOverflow.
So, let’s discuss how it could be accomplished using XLV. For Accordion we will utilize jQuery UI library.

Accordion

Implementation

FAQ Custom List

First of all, let us define where  the questions and answers (FAQ) we’ll be stored. For this we will use Custom List with Content Type.

Custom View for arranging items using jQuery UI Accordion

After creating Custom List we add new View for displaying Accordion for FAQ items

XSLT style sheet for rendering Accordion View

XSLT style sheet for FAQ List is intended for the following purposes:

  • loading jQuery Core and UI Libraries
  • rendering list items using layout as specified for Accordion menu
  • initializing and rendering Accordion for List items

Using jQuery UI Accordion

jQuery Core and UI libraries are injected during XSLT style sheet processing. After JavaScript files which hosted on Microsoft CDN are loaded, jQuery UI Accordion is initialized for items.

Results

FAQ List Accordion View rendered in XLV is shown below on picture

FAQ Accordion View

References

Advertisements

14 thoughts on “Customize the rendering of a List View in Sharepoint 2010: Displaying List Items in Accordion

  1. Pingback: Customize the rendering of a List View in Sharepoint 2013: Displaying List Items in Accordion | Yet Another SharePoint Blog

  2. Hi there, just wanted to say that I’m new to SharePoint development i.e. coded solutions and have downloaded this and tried it and it’s great! Thanks for sharing this.
    Nicola

      • Thank you Vadim!

        Hopefully only one more question…

        I’m testing the accordion by typing in:

        I’m a vExpert… What about me?

        and it’s showing in the Accordion header as:

        I'm a vExpert… What about me?

        I realise this is html code for the ‘ symbol but any solution to how to remove it so it displays normally?

        Thanks so much.

        Nicola

  3. Hi, this is great as it is exactly what I am looking for.
    I do not have visual studio, is there an alternative?
    As a newbie, I could do with a bit more details on: ‘Go there to type this code…’

  4. Pingback: XSL(XSLT) Based Views(XSL File Reference in WebPart) in SharePoint 2013 | Pankaj Salunkhe SharePoint Knowledge

  5. I follow your step to create Accordion for SP2013. It works on publishing page but not in wiki page. Is there any i can resolve for wiki page?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s