Any help? Other fields such as ID works fine..

window.COB = window.COB || {};
window.COB.accordionItem = {
customItemHtml: function (ctx) {

    var accordionItemHtml = "<div title='" + ctx.CurrentItem.Title + "'>" + ctx.CurrentItem.Description;
    accordionItemHtml += "</div>";  
    return accordionItemHtml;
(function () {
var overrideCtx = {};
overrideCtx.Templates = {};
overrideCtx.Templates.Item = window.COB.accordionItem.customItemHtml;
  • 3
    Make sure fields added in code exists in selected view as well. – Deepmala Apr 3 '18 at 3:51
  • Yes Deepmala is right. You can only access the fields that are rendered in the current view. If the field is not present in you view then you will get undefined. – Rohit Waghela Apr 3 '18 at 7:57

Your code looks fine so I added it to a demo site and it works. I would suggest doing as @Deepmala suggested and check that Title and Description fields are included in the current view.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.