可能的错误:当有分组的列时,topCalcs和bottomCalcs跳过并对齐错误

时间:2019-06-24 18:49:46

标签: tabulator

我有一个预算表,其中包含当年每个月的列。过去的月份(1月至5月)显示实际支出,而未来的月份(7月至12月)显示预测值。我正在使用列分组来显示具有多个列的当前月份:预测,实际和方差。我还将行分为支出类别:人工,公用事业等。

当我将bottomCalcs或headerCalcs放入时,每列的总计看起来不错,但组小计未对齐。分组的列calcs丢失了,因此calc字段显示了应在其应显示(Jan,Feb,Mar,Apr,Aug,May,Jun Act,1月,2月,3月,4月,5月,7月,8月, Jun Fore,Jun Var)。

编辑:添加了我的代码 数据:

var tableData = [
{id:1, Project:"40100", ProjectDesc:"Labor", Category:"40101", CategoryDesc:"Labor/Team A", 
m2019_01_Activity:"44265.9400", m2019_02_Activity:"96012.8500", m2019_03_Activity:"53292.4000", m2019_04_Activity:"52529.7000", m2019_05_Activity:"20495.7200", variance:-47754.2800,  m2019_06_Forecast:"68250.0000", m2019_06_Activity:"", m2019_07_Forecast:"68250.0000", m2019_08_Forecast:"68250.0000",   m2019_09_Forecast:"68250.0000",   m2019_10_Forecast:"68250.0000",   m2019_11_Forecast:"68250.0000",   m2019_12_Forecast:"68250.0000",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:2, Project:"40100", ProjectDesc:"Labor", Category:"40102", CategoryDesc:"Labor/Team B", 
m2019_01_Activity:"50025.6500", m2019_02_Activity:"72962.0600",  m2019_03_Activity:"31368.1300",  m2019_04_Activity:"26632.1700", m2019_05_Activity:"34358.8800", variance:-8121.1200,  m2019_06_Forecast:"42480.0000", m2019_06_Activity:"0.0000", m2019_07_Forecast:"42480.0000",  m2019_08_Forecast:"42480.0000",   m2019_09_Forecast:"42480.0000",   m2019_10_Forecast:"42480.0000",   m2019_11_Forecast:"42480.0000",   m2019_12_Forecast:"42480.0000",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:3, Project:"40100", ProjectDesc:"Labor", Category:"40103", CategoryDesc:"Training & Development", 
m2019_01_Activity:"", m2019_02_Activity:"",  m2019_03_Activity:"",  m2019_04_Activity:"", m2019_05_Activity:"", variance:0,  m2019_06_Forecast:"", m2019_06_Activity:"", m2019_07_Forecast:"",   m2019_08_Forecast:"",   m2019_09_Forecast:"",   m2019_10_Forecast:"",   m2019_11_Forecast:"",   m2019_12_Forecast:"",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:4, Project:"40100", ProjectDesc:"Labor", Category:"40104", CategoryDesc:"Dues, Licenses, & Subscriptions", 
m2019_01_Activity:"", m2019_02_Activity:"",  m2019_03_Activity:"",  m2019_04_Activity:"",  m2019_05_Activity:"", variance:0,  m2019_06_Forecast:"", m2019_06_Activity:"", m2019_07_Forecast:"",   m2019_08_Forecast:"",   m2019_09_Forecast:"",   m2019_10_Forecast:"",   m2019_11_Forecast:"",   m2019_12_Forecast:"",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:5, Project:"40100", ProjectDesc:"Labor", Category:"40105", CategoryDesc:"Employee Travel (non-site)", 
m2019_01_Activity:"", m2019_02_Activity:"2434.5800",  m2019_03_Activity:"1785.4400",  m2019_04_Activity:"1265.6400",  m2019_05_Activity:"", variance:-1250.0000,  m2019_06_Forecast:"1250.0000", m2019_06_Activity:"", m2019_07_Forecast:"1250.0000",   m2019_08_Forecast:"1250.0000",   m2019_09_Forecast:"1250.0000",   m2019_10_Forecast:"1250.0000",   m2019_11_Forecast:"1250.0000",   m2019_12_Forecast:"1250.0000",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:6, Project:"40100", ProjectDesc:"Labor", Category:"40106", CategoryDesc:"Relocation", 
m2019_01_Activity:"", m2019_02_Activity:"",  m2019_03_Activity:"",  m2019_04_Activity:"",  m2019_05_Activity:"", variance:0,  m2019_06_Forecast:"", m2019_06_Activity:"", m2019_07_Forecast:"25000.0000",   m2019_08_Forecast:"",   m2019_09_Forecast:"",   m2019_10_Forecast:"",   m2019_11_Forecast:"",   m2019_12_Forecast:"",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:7, Project:"40200", ProjectDesc:"Fuel", Category:"40201", CategoryDesc:"Gasoline", 
m2019_01_Activity:"8475.0000", m2019_02_Activity:"60781.0400", m2019_03_Activity:"17033.5000",  m2019_04_Activity:"35245.1000",  m2019_05_Activity:"-12258.7000", variance:-28258.7000,  m2019_06_Forecast:"12000.0000", m2019_06_Activity:"0.0000", m2019_07_Forecast:"10000.0000",   m2019_08_Forecast:"10000.0000",   m2019_09_Forecast:"10000.0000",   m2019_10_Forecast:"10000.0000",   m2019_11_Forecast:"",   m2019_12_Forecast:"",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:8, Project:"40200", ProjectDesc:"Fuel", Category:"40202", CategoryDesc:"Diesel", 
m2019_01_Activity:"", m2019_02_Activity:"", m2019_03_Activity:"0.0000", m2019_04_Activity:"0.0000",  m2019_05_Activity:"", variance:0,  m2019_06_Forecast:"", m2019_06_Activity:"", m2019_07_Forecast:"",   m2019_08_Forecast:"",   m2019_09_Forecast:"",   m2019_10_Forecast:"",   m2019_11_Forecast:"",   m2019_12_Forecast:"",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:9, Project:"40200", ProjectDesc:"Fuel", Category:"40203", CategoryDesc:"CNG", 
m2019_01_Activity:"3741.7200", m2019_02_Activity:"0.0000",  m2019_03_Activity:"",  m2019_04_Activity:"",  m2019_05_Activity:"", variance:0,  m2019_06_Forecast:"", m2019_06_Activity:"", m2019_07_Forecast:"",   m2019_08_Forecast:"",   m2019_09_Forecast:"",   m2019_10_Forecast:"",   m2019_11_Forecast:"",   m2019_12_Forecast:"",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:10, Project:"40200", ProjectDesc:"Fuel", Category:"40204", CategoryDesc:"Heating Oil", 
m2019_01_Activity:"448.0000", m2019_02_Activity:"",  m2019_03_Activity:"",  m2019_04_Activity:"",  m2019_05_Activity:"21537.0000", variance:-28463.0000,  m2019_06_Forecast:"100000.0000", m2019_06_Activity:"", m2019_07_Forecast:"100000.0000",   m2019_08_Forecast:"75000.0000",   m2019_09_Forecast:"75000.0000",   m2019_10_Forecast:"25000.0000",   m2019_11_Forecast:"25000.0000",   m2019_12_Forecast:"",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"},
{id:11, Project:"40200", ProjectDesc:"Fuel", Category:"40205", CategoryDesc:"Propane", 
m2019_01_Activity:"33738.1800", m2019_02_Activity:"11436.0400",  m2019_03_Activity:"16123.1100",  m2019_04_Activity:"12750.0700", m2019_05_Activity:"7051.7500", variance:-5448.2500,  m2019_06_Forecast:"12500.0000", m2019_06_Activity:"0.0000", m2019_07_Forecast:"12500.0000",   m2019_08_Forecast:"12500.0000",   m2019_09_Forecast:"12500.0000",   m2019_10_Forecast:"12500.0000",   m2019_11_Forecast:"12500.0000",   m2019_12_Forecast:"12500.0000",   datadate:"2019-05", datadateMonth:"5", datadateYear:"2019"}
];

表定义:

table = new Tabulator("#datatable", {
        resizableColumns:"header",
        data:tableData,
        groupBy:"ProjectDesc",
        height:window.innerHeight - divRect.top-35,
        columns:[
            {title:"Project", field:"Project", headerFilter:"input", visible:false},
            {title:"Area Budget", field:"ProjectDesc", headerFilter:"input", visible:false},
            {title:"Category", field:"Category", headerFilter:"input", visible:false},
            {title:"CategoryDesc", field:"CategoryDesc", headerFilter:"input", visible:false},
            {title:"SUB CODE", field:"SubCategory", headerFilter:"input"},
            {title:"DESCRIPTION", field:"SubCategoryDesc", headerFilter:"input"},
            {title:"BUDGET", field:"Budget", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}},
            {title:"EAC", field:"EAC", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}},
            {title:"Budget Var", field:"Budget_Variance", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}},
            {title:"2019-01 Activity", field:"m2019_01_Activity", titleFormatter:activityColumn, sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            {title:"2019-02 Activity", titleFormatter:activityColumn, field:"m2019_02_Activity", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            {title:"2019-03 Activity",titleFormatter:activityColumn, field:"m2019_03_Activity", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            {title:"2019-04 Activity",titleFormatter:activityColumn, field:"m2019_04_Activity", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            {title:"2019-05 Activity",titleFormatter:activityColumn, field:"m2019_05_Activity", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            //this is where the grouped columns are inserted
            {title:"2019-07 Forecast", titleFormatter:activityColumn, field:"m2019_07_Forecast", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            {title:"2019-08 Forecast", titleFormatter:activityColumn, field:"m2019_08_Forecast", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            {title:"2019-09 Forecast", titleFormatter:activityColumn, field:"m2019_09_Forecast", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            {title:"2019-10 Forecast", titleFormatter:activityColumn, field:"m2019_10_Forecast", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            {title:"2019-11 Forecast", titleFormatter:activityColumn, field:"m2019_11_Forecast", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
            {title:"2019-12 Forecast", titleFormatter:activityColumn, field:"m2019_12_Forecast", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},

        ],
    });

table.addColumn( {title:"2019-06", width:255, columns:[
        {title:"Forecast", field:"m2019_06_Forecast", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
        {title:"Activity", field:"m2019_06_Activity", sorter:"number", formatter:"money", align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85},
        {title:"Variance", field:"variance", formatter:specialMoney, align:"right", topCalc:"sum", topCalcFormatter:"money", topCalcFormatterParams:{ decimal: ".", thousand: ",", precision:0}, width:85}
    ]},false, "m2019_07_Forecast");

1 个答案:

答案 0 :(得分:0)

嗯,看起来像个虫子,我现在找到了解决方法

const tableData = [{
    id: 1,
    Project: "40100",
    ProjectDesc: "Labor",
    Category: "40101",
    CategoryDesc: "Labor/Team A",
    m2019_01_Activity: "44265.9400",
    m2019_02_Activity: "96012.8500",
    m2019_03_Activity: "53292.4000",
    m2019_04_Activity: "52529.7000",
    m2019_05_Activity: "20495.7200",
    variance: -47754.2800,
    m2019_06_Forecast: "68250.0000",
    m2019_06_Activity: "",
    m2019_07_Forecast: "68250.0000",
    m2019_08_Forecast: "68250.0000",
    m2019_09_Forecast: "68250.0000",
    m2019_10_Forecast: "68250.0000",
    m2019_11_Forecast: "68250.0000",
    m2019_12_Forecast: "68250.0000",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 2,
    Project: "40100",
    ProjectDesc: "Labor",
    Category: "40102",
    CategoryDesc: "Labor/Team B",
    m2019_01_Activity: "50025.6500",
    m2019_02_Activity: "72962.0600",
    m2019_03_Activity: "31368.1300",
    m2019_04_Activity: "26632.1700",
    m2019_05_Activity: "34358.8800",
    variance: -8121.1200,
    m2019_06_Forecast: "42480.0000",
    m2019_06_Activity: "0.0000",
    m2019_07_Forecast: "42480.0000",
    m2019_08_Forecast: "42480.0000",
    m2019_09_Forecast: "42480.0000",
    m2019_10_Forecast: "42480.0000",
    m2019_11_Forecast: "42480.0000",
    m2019_12_Forecast: "42480.0000",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 3,
    Project: "40100",
    ProjectDesc: "Labor",
    Category: "40103",
    CategoryDesc: "Training & Development",
    m2019_01_Activity: "",
    m2019_02_Activity: "",
    m2019_03_Activity: "",
    m2019_04_Activity: "",
    m2019_05_Activity: "",
    variance: 0,
    m2019_06_Forecast: "",
    m2019_06_Activity: "",
    m2019_07_Forecast: "",
    m2019_08_Forecast: "",
    m2019_09_Forecast: "",
    m2019_10_Forecast: "",
    m2019_11_Forecast: "",
    m2019_12_Forecast: "",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 4,
    Project: "40100",
    ProjectDesc: "Labor",
    Category: "40104",
    CategoryDesc: "Dues, Licenses, & Subscriptions",
    m2019_01_Activity: "",
    m2019_02_Activity: "",
    m2019_03_Activity: "",
    m2019_04_Activity: "",
    m2019_05_Activity: "",
    variance: 0,
    m2019_06_Forecast: "",
    m2019_06_Activity: "",
    m2019_07_Forecast: "",
    m2019_08_Forecast: "",
    m2019_09_Forecast: "",
    m2019_10_Forecast: "",
    m2019_11_Forecast: "",
    m2019_12_Forecast: "",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 5,
    Project: "40100",
    ProjectDesc: "Labor",
    Category: "40105",
    CategoryDesc: "Employee Travel (non-site)",
    m2019_01_Activity: "",
    m2019_02_Activity: "2434.5800",
    m2019_03_Activity: "1785.4400",
    m2019_04_Activity: "1265.6400",
    m2019_05_Activity: "",
    variance: -1250.0000,
    m2019_06_Forecast: "1250.0000",
    m2019_06_Activity: "",
    m2019_07_Forecast: "1250.0000",
    m2019_08_Forecast: "1250.0000",
    m2019_09_Forecast: "1250.0000",
    m2019_10_Forecast: "1250.0000",
    m2019_11_Forecast: "1250.0000",
    m2019_12_Forecast: "1250.0000",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 6,
    Project: "40100",
    ProjectDesc: "Labor",
    Category: "40106",
    CategoryDesc: "Relocation",
    m2019_01_Activity: "",
    m2019_02_Activity: "",
    m2019_03_Activity: "",
    m2019_04_Activity: "",
    m2019_05_Activity: "",
    variance: 0,
    m2019_06_Forecast: "",
    m2019_06_Activity: "",
    m2019_07_Forecast: "25000.0000",
    m2019_08_Forecast: "",
    m2019_09_Forecast: "",
    m2019_10_Forecast: "",
    m2019_11_Forecast: "",
    m2019_12_Forecast: "",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 7,
    Project: "40200",
    ProjectDesc: "Fuel",
    Category: "40201",
    CategoryDesc: "Gasoline",
    m2019_01_Activity: "8475.0000",
    m2019_02_Activity: "60781.0400",
    m2019_03_Activity: "17033.5000",
    m2019_04_Activity: "35245.1000",
    m2019_05_Activity: "-12258.7000",
    variance: -28258.7000,
    m2019_06_Forecast: "12000.0000",
    m2019_06_Activity: "0.0000",
    m2019_07_Forecast: "10000.0000",
    m2019_08_Forecast: "10000.0000",
    m2019_09_Forecast: "10000.0000",
    m2019_10_Forecast: "10000.0000",
    m2019_11_Forecast: "",
    m2019_12_Forecast: "",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 8,
    Project: "40200",
    ProjectDesc: "Fuel",
    Category: "40202",
    CategoryDesc: "Diesel",
    m2019_01_Activity: "",
    m2019_02_Activity: "",
    m2019_03_Activity: "0.0000",
    m2019_04_Activity: "0.0000",
    m2019_05_Activity: "",
    variance: 0,
    m2019_06_Forecast: "",
    m2019_06_Activity: "",
    m2019_07_Forecast: "",
    m2019_08_Forecast: "",
    m2019_09_Forecast: "",
    m2019_10_Forecast: "",
    m2019_11_Forecast: "",
    m2019_12_Forecast: "",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 9,
    Project: "40200",
    ProjectDesc: "Fuel",
    Category: "40203",
    CategoryDesc: "CNG",
    m2019_01_Activity: "3741.7200",
    m2019_02_Activity: "0.0000",
    m2019_03_Activity: "",
    m2019_04_Activity: "",
    m2019_05_Activity: "",
    variance: 0,
    m2019_06_Forecast: "",
    m2019_06_Activity: "",
    m2019_07_Forecast: "",
    m2019_08_Forecast: "",
    m2019_09_Forecast: "",
    m2019_10_Forecast: "",
    m2019_11_Forecast: "",
    m2019_12_Forecast: "",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 10,
    Project: "40200",
    ProjectDesc: "Fuel",
    Category: "40204",
    CategoryDesc: "Heating Oil",
    m2019_01_Activity: "448.0000",
    m2019_02_Activity: "",
    m2019_03_Activity: "",
    m2019_04_Activity: "",
    m2019_05_Activity: "21537.0000",
    variance: -28463.0000,
    m2019_06_Forecast: "100000.0000",
    m2019_06_Activity: "",
    m2019_07_Forecast: "100000.0000",
    m2019_08_Forecast: "75000.0000",
    m2019_09_Forecast: "75000.0000",
    m2019_10_Forecast: "25000.0000",
    m2019_11_Forecast: "25000.0000",
    m2019_12_Forecast: "",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  },
  {
    id: 11,
    Project: "40200",
    ProjectDesc: "Fuel",
    Category: "40205",
    CategoryDesc: "Propane",
    m2019_01_Activity: "33738.1800",
    m2019_02_Activity: "11436.0400",
    m2019_03_Activity: "16123.1100",
    m2019_04_Activity: "12750.0700",
    m2019_05_Activity: "7051.7500",
    variance: -5448.2500,
    m2019_06_Forecast: "12500.0000",
    m2019_06_Activity: "0.0000",
    m2019_07_Forecast: "12500.0000",
    m2019_08_Forecast: "12500.0000",
    m2019_09_Forecast: "12500.0000",
    m2019_10_Forecast: "12500.0000",
    m2019_11_Forecast: "12500.0000",
    m2019_12_Forecast: "12500.0000",
    datadate: "2019-05",
    datadateMonth: "5",
    datadateYear: "2019"
  }
];

const table = new Tabulator("#datatable", {
  resizableColumns: "header",
  data: tableData,
  groupBy: "ProjectDesc"

});
const newColumn = [{
    title: "Project",
    field: "Project",
    headerFilter: "input",
    visible: false
  },
  {
    title: "Area Budget",
    field: "ProjectDesc",
    headerFilter: "input",
    visible: false
  },
  {
    title: "Category",
    field: "Category",
    headerFilter: "input",
    visible: false
  },
  {
    title: "CategoryDesc",
    field: "CategoryDesc",
    headerFilter: "input",
    visible: false
  },
  {
    title: "SUB CODE",
    field: "SubCategory",
    headerFilter: "input"
  },
  {
    title: "DESCRIPTION",
    field: "SubCategoryDesc",
    headerFilter: "input"
  },
  {
    title: "BUDGET",
    field: "Budget",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    }
  },
  {
    title: "EAC",
    field: "EAC",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    }
  },
  {
    title: "Budget Var",
    field: "Budget_Variance",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    }
  },
  {
    title: "2019-01 Activity",
    field: "m2019_01_Activity",
    // titleFormatter: activityColumn,
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "2019-02 Activity",
    // titleFormatter: activityColumn,
    field: "m2019_02_Activity",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "2019-03 Activity",
    //titleFormatter: activityColumn,
    field: "m2019_03_Activity",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "2019-04 Activity",
    //titleFormatter: activityColumn,
    field: "m2019_04_Activity",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "2019-05 Activity",
    // titleFormatter: activityColumn,
    field: "m2019_05_Activity",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  //this is where the grouped columns are inserted
  {
    title: "2019-07 Forecast",
    //  titleFormatter: activityColumn,
    field: "m2019_07_Forecast",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "2019-08 Forecast",
    //  titleFormatter: activityColumn,
    field: "m2019_08_Forecast",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "2019-09 Forecast",
    //  titleFormatter: activityColumn,
    field: "m2019_09_Forecast",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "2019-10 Forecast",
    //  titleFormatter: activityColumn,
    field: "m2019_10_Forecast",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "2019-11 Forecast",
    //  titleFormatter: activityColumn,
    field: "m2019_11_Forecast",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "2019-12 Forecast",
    //  titleFormatter: activityColumn,
    field: "m2019_12_Forecast",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "Forecast",
    field: "m2019_06_Forecast",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "Activity",
    field: "m2019_06_Activity",
    sorter: "number",
    formatter: "money",
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  },
  {
    title: "Variance",
    field: "variance",
    //formatter: specialMoney,
    align: "right",
    topCalc: "sum",
    topCalcFormatter: "money",
    topCalcFormatterParams: {
      decimal: ".",
      thousand: ",",
      precision: 0
    },
    width: 85
  }

];
table.setColumns(newColumn);

$('.tabulator-col-title').each(function() {

  if ($(this).text() === "BUDGET") {
    $(this).click();
    $(this).click();
  }

});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<head>
  <link href="https://unpkg.com/tabulator-tables@4.2.7/dist/css/tabulator.min.css" rel="stylesheet">
  <script type="text/javascript" src="https://unpkg.com/tabulator-tables@4.2.7/dist/js/tabulator.min.js"></script>
</head>

<html>
<div id="datatable"></div>

</html>