// Setting the third parameter of pivotUI() to true causes an overwrite
// of the existing configuration.
// This enables the saving/reloading of configs stored under the pivotUIOptions
// data element.
// To see this in action:
// 1. configure the pivot table however you like then hit 'save'
// 2. reload the page then hit 'restore' to see your saved configuration
$(function(){
$.getJSON("<?php echo STATIK_URL;?>assets/pivot/mps.json", function(mps) {
$("#output2").pivotUI(mps);
$("#save").on("click", function(){
var config = $("#output2").data("pivotUIOptions");
console.log(config);
var config_copy = JSON.parse(JSON.stringify(config));
//delete some values which will not serialize to JSON
delete config_copy["aggregators"];
delete config_copy["renderers"];
delete config_copy["rendererOptions"];
delete config_copy["localeStrings"];
$.cookie("pivotConfig", JSON.stringify(config_copy));
});
$("#restore").on("click", function(){
$("#output2").pivotUI(mps, JSON.parse($.cookie("pivotConfig")));
console.log($.cookie("pivotConfig"));
});
});
});
Hi , Please help me.
mysicript is
// Setting the third parameter of pivotUI() to true causes an overwrite // of the existing configuration. // This enables the saving/reloading of configs stored under the pivotUIOptions // data element. // To see this in action: // 1. configure the pivot table however you like then hit 'save' // 2. reload the page then hit 'restore' to see your saved configuration
my result is
{ "rendererOptions": { "localeStrings": { "renderError": "An error occurred rendering the PivotTable results.", "computeError": "An error occurred computing the PivotTable results.", "uiRenderError": "An error occurred rendering the PivotTable UI.", "selectAll": "Select All", "selectNone": "Select None", "tooMany": "(too many to list)", "filterResults": "Filter values", "apply": "Apply", "cancel": "Cancel", "totals": "Totals", "vs": "vs", "by": "by" } }, "localeStrings": { "renderError": "An error occurred rendering the PivotTable results.", "computeError": "An error occurred computing the PivotTable results.", "uiRenderError": "An error occurred rendering the PivotTable UI.", "selectAll": "Select All", "selectNone": "Select None", "tooMany": "(too many to list)", "filterResults": "Filter values", "apply": "Apply", "cancel": "Cancel", "totals": "Totals", "vs": "vs", "by": "by" }, "derivedAttributes": {}, "aggregators": {}, "renderers": {}, "hiddenAttributes": [], "hiddenFromAggregators": [], "hiddenFromDragDrop": [], "menuLimit": 500, "cols": [], "rows": [ "Province" ], "vals": [], "rowOrder": "key_a_to_z", "colOrder": "key_a_to_z", "exclusions": {}, "inclusions": {}, "unusedAttrsVertical": 85, "autoSortUnusedAttrs": false, "onRefresh": null, "showUI": true, "sorters": {}, "inclusionsInfo": {}, "aggregatorName": "Count", "rendererName": "Table" }