I have a table that was developed on a SharePoint page with column sorting. There is a Print button on the page that prints the following:
case "Print":
var url = edmscPage.WebRelativeUrl + "/SitePages/PrintFilePlan.aspx?FilePlanId=" + FilePlan.Id + "&SourceUrl=" + encodeURIComponent(window.location.href);
window.open(url);
edmscPage.HideWaitScreenDialog();
break;
The JS for the sorting is:
CreateClickableSortElement: function(name){
var clickElement = edmscForm.CreateElement("span", [{Key: "onclick", Value: "FilePlanSortManager.MutationSortFilePlanItems(this)"}, {Key:"data-colname", Value: name}, {Key:"class", "Value":"sort-arrows"}], "↑↓");
return clickElement;
},
MutationSortFilePlanItems: function(onclickElement){
// Get the stored element column name attribute.
var colName = onclickElement.getAttribute("data-colname");
// Get our local mapping from the DOM column name.
var mapping = GetColumnMapByDisplayName(colName);
// To prevent weird behavior, reset everything (else) to the default ascending sort order.
ResetUnusedMappings(colName);
// Roll out the sorting property against the data objects in the back end.
var sortProperties = mapping.DataColumns;
// This starts as false on page load, so we flip early to make ascending our default sort order.
// This keeps the variable in line with expected behavior, rather than the expected next stage.
mapping.SortAsc = !mapping.SortAsc;
FilePlanItem.Items.sort(function (a, b) {
var comparisonStringA = "";
var comparisonStringB = "";
for(var s in sortProperties){
var property = sortProperties[s];
comparisonStringA += a[property];
comparisonStringB += b[property];
}
return comparisonStringA.localeCompare(comparisonStringB);
});
if(!mapping.SortAsc){
FilePlanItem.Items.reverse();
}
document.getElementById("rrsFilePlanItems").innerHTML = "";
FilePlanForm.LoadItemsSection();
}
}
})(FilePlanSortManager);
Any page that is printed loses its sorting. I want to be able to take that sorting the end user has and apply it to the print out page.
Thanks