I am trying to make a pivotable. I have data structured like this:
["periode", "_alder_5i40s_hrchy_id", "_alder_5i40s_txt", "alder40s_txt", "alder5i_txt", "_rajo_hrchy_id", "_omrade_txt", "_tilb_2ptv_hrchy_id", "_tilb_2ptv_txt", "tilb_2ptv_txt", "tilb_1ptv_txt", "tilb_0ptv_txt", "measc02_1", "measc01_1", "membc02_1"]
["2014M01", "/50/", "40+ år ", "40+ år ", null, "/1/", "RAR Hovedstaden", "/10/", "Vejledning og opkvalificering i alt ", "Vejledning og opkvalificering i alt ", null, null, "69", "63", "1"], ["2015M01", "/50/", "40+ år ", "40+ år ", null, "/1/", "RAR Hovedstaden", "/10/", "Vejledning og opkvalificering i alt ", "Vejledning og opkvalificering i alt ", null, null, "399", "356", "1"], ["2014M01", "/50/", "40+ år ", "40+ år ", null, "/1/", "RAR Hovedstaden", "/40/700/", "Privat virksomhedspraktik ", "Virksomhedspraktik i alt", "Privat virksomhedspraktik ", null, "5", "5", "1"], ["2015M01", "/50/", "40+ år ", "40+ år ", null, "/1/", "RAR Hovedstaden", "/40/700/", "Privat virksomhedspraktik ", "Virksomhedspraktik i alt", "Privat virksomhedspraktik ", null, "39", "38", "1"],
With the last 3 fields being the values to be displayed in the table. The problem is that I have 3 values for each line and I can't figure out how to display that with the text from the header as well.
Is the only solution to split up all the lines in 3 as to have name and the value in the same line? Such as:
["periode", "_alder_5i40s_hrchy_id", "_alder_5i40s_txt", "alder40s_txt", "alder5i_txt", "_rajo_hrchy_id", "_omrade_txt", "_tilb_2ptv_hrchy_id", "_tilb_2ptv_txt", "tilb_2ptv_txt", "tilb_1ptv_txt", "tilb_0ptv_txt", member_name, member_value]
["2014M01", "/50/", "40+ år ", "40+ år ", null, "/1/", "RAR Hovedstaden", "/10/", "Vejledning og opkvalificering i alt ", "Vejledning og opkvalificering i alt ", null, null, measc02_1, "69", ]
Or have I overlooked some nice feature that could handle this smarter?
Hope you will help me :)
Code as of now:
$(this.shadowRoot).find("#databanktable").pivotUI(
[data.header, ...data.data],
{
cols : this.tableColumns,
rows : this.tableRows,
vals,
rendererOptions: {
table: {
colTotals: false,
rowTotals: false,
},
},
showUI: false,
aggregatorName:"List Unique Values",
rendererName: "Table",
},true);