Displaying Repeating Section as table in List View - the CSR approach

  • 18 December 2015
  • 40 replies
  • 143 views


Show first post

40 replies

Badge +8

Hi,

Really Not

Federico

Yes.. Thanks. Finally it is working great..

Badge +9

What was the issue?

it was a typo

This implementation doesn't support In line editing. It gives error - TypeError: Unable to get property 'DecodeXMLNotation' of undefined or null reference.  on edit. Any fix on it?

Badge +6

Or maybe it's a pivot table based on and aggregating some data stored in a different format like pairs of "Jurong East"-"Table" and "Test"-"Chair".

Badge +6

Make sure you reference jQuery (NWF$) and your form controls correctly. That should help with those errors.

Badge +2

Hi,

This is great when viewing the items in the list!

But if we have a workflow that creates a task and we want to view the related item fields in the task form template using List Item control the repeatable section is again rendered as XML.

Is there any workaround to this and why this Forms control cannot handle the repeating sections?

Thanks,

Ivan

Badge +3

Hi Ivan,

I have the same issue and  Eric Harris   helped me to solve this creating a workflow. The CSR approach remains same adding in the Script editor. CSR approach is only to hide the XML in the SharePoint List. To hide the XML in the Workflow process i.e., in the approval process workflow should be created.

Step 1: Query XML

Step 2: Build String

Step 3: Set Field Value

And also Please check Vadim Tabakman​ posts for these Repeating sections.

I have faced same issue while data migration. And corrected by removing special characters using HTML encode while constructing the XML.

Ram was right, the JSLink/CSR is just the changing the way the content is being rendered at the client end, the original content still remain untouched.

Badge +2

Hi Kok Koon Gan​ and ram Kanteti​ thanks for the replays, but I think that I did not explained this very well. I do not want to change the xml or anything I just want to properly display it in the task forms. Anyway I found the solution myself, not sure if this is a practice, but it worked out really well for me and I shared it in this post  Another SharePoint Blog: Display related item repeating section in Nintex Workflow task form

Badge +2

Hi Kok Koon Gan, can you help me with my version of the script? I cannot get it to display the XML in a table view and have no idea what I'm doing wrong:

SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Fields: {
'Questions_to_Verify_Scope': {
'View': repeatingSectionViewTemplate
}
}
}
});

function repeatingSectionViewTemplate(ctx) {
var xml = ctx.CurrentItem["Questions_to_Verify_Scope"];
var decodedxml = xml.DecodeXMLNotation();
var htm = "";
xmlDoc = $.parseXML( decodedxml );
$xml = $( xmlDoc );
$xml.find("Item").each(function() {
htm = htm + "<tr><td>" + $(this).find("Questions").text() + "</td><td>" + $(this).find("Answers").text() + "</td></tr>";
});

return "<table border='1' class ='gridmtable'><tr><th><b>Questions</b></th><th><b>Answers</b></th></tr>" + htm +"</table>";
};

//Replaces html notation to their equivalent xml escape characters.
String.prototype.DecodeXMLNotation = function () {
var output = this;
if ($.trim(output) != "") {
output = output.replace(/&apos;/g, "'").replace(/&quot;/g, '"').replace(/&gt;/g, '>').replace(/&lt;/g, '<').replace(/&amp;/g, '&');
}
else {
output = "";
}
return output;
};
</script>

This is what the output currently looks like:

Thank you for your help!

Nancy

If that is the output, looks to me ur script is not being executed... u will need to fix that first.

This script worked great in a standard list view. Any idea how to adapt it to the preview pane style? XML is still showing on the preview pane view.

Reply