I am using Tabulator 4.8 (tabulator.info)
I see documentation for adding nested tables to Tabulator rows (http://tabulator.info/examples/4.8#nested-tables)
I would like to do something similar to that but instead add a Tabulator table to a cell of Tabulator table.
I read about custom formatting of cells (http://tabulator.info/docs/4.0/format#format-custom) and see it says the formatting function must return a String, valid html or a DOM node.
I tried something like the following (following the example for nested table in rows):
columns:[ //Define Table Columns
{title:"Name", field:"name", width:150},
{title:"Age", field:"age", hozAlign:"left", formatter:"progress"},
{title:"Favourite Color", field:"col", formatter:function(cell){
//create and style holder elements
var holderEl = document.createElement("div");
var tableEl = document.createElement("div");
holderEl.style.boxSizing = "border-box";
holderEl.style.padding = "10px 30px 10px 10px";
holderEl.style.borderTop = "1px solid #333";
holderEl.style.borderBotom = "1px solid #333";
holderEl.style.background = "#ddd";
tableEl.style.border = "1px solid #333";
holderEl.appendChild(tableEl);
cell.getElement().appendChild(holderEl);
var subTable = new Tabulator(tableEl, {
layout:"fitColumns",
data:tabledata,
columns:[
{title:"Name", field:"name", width:150},
{title:"Age", field:"age", hozAlign:"left", formatter:"progress"},
{title:"Favourite Color", field:"col", formatter:"star", formatterParams:{stars:6}},
{title:"Date Of Birth", field:"dob", sorter:"date", hozAlign:"center"},
]
})
return subTable;
}},
{title:"Date Of Birth", field:"dob", sorter:"date", hozAlign:"center"},
],
But this does not show up in the cell as a nested table. Of course if I return "<table><tr><td>test</td></tr></table>";, I see that simple table but I would like to see the tabulator table in there.
Any tips on how to do that?