Der Code wird von einer Website kopiert, die XML in ein lesbares HTML-Format konvertiert ... Das Problem ist nur das Datumsformat, bei dem ich Schwierigkeiten habe, die Änderung umzusetzen.
Code: Select all
SPClientTemplates.TemplateManager.RegisterTemplateOverrides({
Templates: {
Fields: {
'ItemsOverview': {
'View': repeatingSectionViewTemplate
}
}
}
});
function repeatingSectionViewTemplate(ctx) {
var xml = ctx.CurrentItem["ItemsOverview"];
var decodedxml = xml.DecodeXMLNotation();
var htm = "";
xmlDoc = $.parseXML( decodedxml );
$xml = $( xmlDoc );
$xml.find("Item").each(function() {
htm = htm + "" + $(this).find("ItemNumber").text() + "" + $(this).find("ItemDescription").text() + "" + $(this).find("ItemStatus").text() + "" + $(this).find("ItemDate").text()
+"" + $(this).find("CollectedByUser").text() +"";
});
return "ItemDescriptionStatusDateCollected By" + htm +"";
};
//Replaces html notation to their equivalent xml escape characters.
String.prototype.DecodeXMLNotation = function () {
var output = this;
if ($.trim(output) != "") {
output = output.replace(/'/g, "'").replace(/"/g, '"').replace(/>/g, '>').replace(/</g, '