0

I have a table that receives a .JSON. I have created some filters and I would like to save them but without saving the information that I received at that time with the filter. I already tried:

pivot.getData({},
    function(data) {
        console.log(data);
    },
    function(data) {
        console.log(data);
    }
);

Too

var report = pivot.getReport();
console.log(report);

by last

pivot.save({filename:'reporte.json',embedData : false });

Thanks for your help

Tom
  • 1
  • 3

1 Answers1

1

There are several ways to achieve what you need:

  1. You can still use:

    var report = pivot.getReport();

    the data information is stored in report["dataSource"]. In such a case, you can easily remove the unnecessary object the following way:

    delete report["dataSource"];

    After that, the JSON config is saved as a file to the disk using the following approach: JavaScript: Create and save file.

    The disadvantage of such a solution is that you cannot use the saved JSON config to restore the view since it lacks the data part. You will need to add the "dataSource" part when you decide to restore the view. Therefore, the solution that described below looks better for me.

  2. You can create a web service that returns the data file or simply put the JSON data file to the server. In such a case, WebDataRocks will load the data for you. Then, when you decide to save the config, only the link to the data will be saved to config.

    Here is the reference to docs: https://www.webdatarocks.com/doc/data-source-object/. The "filename" property represents the link which leads to your data file.

    In such a case you don't need any additional customization for the "Save" functionality. You can use a default one. Then it is easy to restore the view using the saved config.

dima_z
  • 38
  • 1
  • 6