Documentation menu

Global Object

This object contains configurations that will be applied to all reports in WebDataRocks. If needed, you can override global configurations in a report.

Check out how global configurations are saved in a report: Saving the report with global configs.

Properties

NameTypeDescription
dataSourceData Source Objectoptional Contains information about the data source.
optionsOptions Objectoptional Defines the view and functionality available for users.
localizationString|Objectoptional Sets a localization. For more details, refer to the language localization tutorial.

Examples

1) Setting a data source that will be used in all reports:

const pivot = new WebDataRocks({
  container: "#wdr-component",
  global: {
    dataSource: {
      type: "json",
      filename: "https://cdn.webdatarocks.com/data/data.json"
    }
  }
});

See the full code on CodePen.

2) Setting options to make all reports read-only:

const pivot = new WebDataRocks({
  container: "#wdr-component",
  global: {
    options: {
      grid: {
        showFilter: false,
        showReportFiltersArea: false,
      },
      configuratorButton: false,
      drillThrough: false,
      sorting: "off", 
    },
  }
});

Check out a live demo on CodePen.

3) Setting a localization that will be applied to all reports:

const pivot = new WebDataRocks({
  container: "#wdr-component",
  global: {
    localization: "https://cdn.webdatarocks.com/loc/es.json"
  }
});

See an example on CodePen.

4) Overriding global configurations in the report:

const pivot = new WebDataRocks({
  container: "#wdr-component",
  global: {
    dataSource: {
      type: "json",
      data: // Inline JSON data
    },
    options: {
      grid: {
        showFilter: false,
      },
      configuratorButton: false,
      sorting: "off", 
    },
  },
  report: {
    dataSource: {
      type: "csv",
      filename: "https://cdn.webdatarocks.com/data/data.csv"
    },
    options: {
      grid: {
        showFilter: true,
      },
      configuratorButton: true,
    },
  }
});

Try it out on CodePen.

See also