Custom Field Titles, JavaScript Programming Example of Custom Field Titles

JavaScript Programming Example of Custom Field Titles

If you need to define custom field titles in Pivot, use the programming example below. It will enable you to set beautiful names for columns instead of the default ones. Feel free to use our coding samples to facilitate the process of web development.

JS Code

webix.ready(function() {
  webix.CustomScroll.init();

  webix.ui({
    view: "pivot",
    structure: {
      columns: ["year"],
      rows: ["form", "name"],
      values: [
        { name: "oil", operation: ["min", "sum"] },
        { operation: "sum(oil) + sum(balance)" },
      ],
    },
    fields: [
      { id: "name", value: "Name", type: "text" },
      { id: "year", value: "Year", type: "number" },
      { id: "continent", value: "Continent", type: "text" },
      { id: "form", value: "Form", type: "text" },
      { id: "gdp", value: "Wealth", type: "number" },
      { id: "oil", value: "Petrol", type: "number" },
      { id: "balance", value: "Income", type: "number" },
    ],
    url: "https://cdn.webix.com/demodata/pivot.json",
  });
});