Show Repeating Section as table in List View

Document created by eharris04 Employee on May 17, 2016
Version 1Show Document
  • View in full screen mode

How to show the Repeating Section as table in List View using the native Sharepoint feature - CSR.

 

AuthorKok Koon Gan
Long DescriptionRepeating Section of Nintex Form is always a popular topic among the communities. I was trying to help a partner looking into issues he encountered implementing the solution proposed by Ayman El-Hattab in his great post of Displaying Repeating Section Data in List Views, The Easy Way!,
Dependencies

Create a Page two include the List View web parts, for the purpose of making this simple, I will include the Script Editor to the same page for the CSR implementation (i.e. you may refer to Microsoft document on other CSR implementation approach using master page and so on.)

Support Info

Kok Koon Gan

Compatibility

Nintex Forms 2013

Nintex Forms O365

Platform

SharePoint Server 2013

Office 365

Screenshots

Additional Information

<script type="text/javascript" src="/Nintex/SiteAssets/jquery-1.11.3.min.js"></script>  
  
<script type="text/javascript">  
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({  
  Templates: {  
           Fields: {  
                'Inventory': {   
                    'View': repeatingSectionViewTemplate  
                 }  
           }  
  }  
});  
  
function repeatingSectionViewTemplate(ctx) {  
   var xml = ctx.CurrentItem["Inventory"];  
   var decodedxml = xml.DecodeXMLNotation();   
   var htm = "";  
     
   xmlDoc = $.parseXML( decodedxml );  
   $xml = $( xmlDoc );  
   $xml.find("Item").each(function() {  
      htm = htm + "<tr><td>" + $(this).find("Product").text() + "</td><td>" + $(this).find("Quantity").text() + "</td></tr>";  
   });  
  
   return "<table border='1'>" + 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> 
 

 

Nintex Xchange Terms of Use Policy

Nintex makes no warranty or guarantee about the reliability, performance, quality, or functionality of any assets, and any assets you install are therefore provided as is. By downloading this asset, you agree to the terms of use.

Attachments

Outcomes