Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="displayDiv"></div>
- <script type="text/javascript" src="https://code.jquery.com/jquery-1.10.1.min.js"></script>
- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.7.1a/jquery.SPServices-0.7.1a.min.js"></script>
- <script type="text/javascript">
- function GetParameterValues(param) {
- var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
- for (var i = 0; i < url.length; i++) {
- var urlparam = url[i].split('=');
- if (urlparam[0] == param) {
- return urlparam[1];
- }
- }
- }
- var currentItemId = GetParameterValues("ID");
- var table="<table><tr><th>Version</th><th>Title</th><th>test01</th><th>Editor</th><th>Modified</th></tr>";
- var html ="";
- var fieldname ="";
- $(function(){
- var oTitle = getFieldVersion("Title");
- var oTest01 = getFieldVersion("test01");
- var oModified = getFieldVersion("Modified");
- var oEditor = getFieldVersion("Editor");
- for (var i = 0; i < oTitle.length; i++) {
- var count = oTitle.length-i;
- html += "<tr>";
- html += "<td>"+ count +"</td>";
- html += "<td>" + oTitle[i] +"</td>";
- html += "<td>" + oTest01[i] +"</td>";
- html += "<td>" + oEditor[i].split("#")[1] +"</td>";
- html += "<td>" + oModified[i] +"</td>";
- html += "</tr>";
- }
- document.getElementById("displayDiv").innerHTML=table+html+"</table>";
- });
- function getFieldVersion(fieldname){
- var versionContent = [];
- $().SPServices({
- operation: "GetVersionCollection",
- async: false,
- strlistID: "cl_versions",
- strlistItemID: currentItemId,
- strFieldName: fieldname,
- completefunc: function (xData, Status) {
- console.log(xData);
- console.log($(xData.responseText).find("Version"));
- $(xData.responseText).find("Version").each(function(i) {
- console.log($(this).attr(fieldname) );
- versionContent.push($(this).attr(fieldname));
- });
- }
- });
- return versionContent;
- }
- </script>
Add Comment
Please, Sign In to add comment