I'm trying to make our list view as an accordion by following this tutorial:
https://code.msdn.microsoft.com/office/Client-side-rendering-code-ccdb2a0e
-
I followed the tutorial:
Create a Custom List, add a new column to the list:
Name: Description
Type: Multiple lines of text
Edit the Default New Form
Go to List view web-part properties and add the JSLink file (~sitecollection/Style Library/JSLink-Samples/Accordion.js) to JS link property under the Miscellaneous Tab. Click Apply.
-
Nothing changed, so I added a Script Editor in that page and pasted js code. Then it kind of works.
Is there anything I did wrong? Thanks!
Unfortunately the list view is rendered properly when
Description
field is type ofPlain text
from the specified example.To render it properly when
Description
field is type ofRich text
orEnhanced
, replace theaccordionTemplate
function with this one:Result
I would recommend you to try another approach to render List View as accordion as demonstrated in Customize the rendering of a List View in Sharepoint 2013: Displaying List Items in Accordion article.
Key points:
JSLink
propertyResult