olifolkerd / tabulator

Interactive Tables and Data Grids for JavaScript
http://tabulator.info
MIT License
6.6k stars 811 forks source link

Nested Tables, RowFormater #2839

Closed Ruzancev closed 4 years ago

Ruzancev commented 4 years ago

Uncaught TypeError: Cannot read property 'getHeight' of undefined at RowManager._removeTopRow


When using the code from the example 'Nested Tables', a similar situation arises.

var nestedData = [ {id:1, make:"Ford", model:"focus", reg:"P232 NJP", color:"white", serviceHistory:[

]},
]

for (var ind = 1; ind< 100; ind++ ) { var row = {id:1, make:"Ford"+ind, model:"focus", reg:"P232 NJP", color:"white", serviceHistory:[ {date:"22/05/2017", engineer:"Jimmy Brown", actions:"Aligned wheels"}, {date:"11/02/2018", engineer:"Lotty Ferberson", actions:"Changed Oil"}, {date:"04/04/2018", engineer:"Franco Martinez", actions:"Fixed Tracking"}, ]};

nestedData.push(row);

}

var table = new Tabulator("#example-table", { //virtualDom : false, height:"311px", layout:"fitColumns", resizableColumns:false, data:nestedData, columns:[ {title:"Make", field:"make"}, {title:"Model", field:"model"}, {title:"Registration", field:"reg"}, {title:"Color", field:"color"}, ], rowFormatter:function(row){ //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);

row.getElement().appendChild(holderEl);

var subTable = new Tabulator(tableEl, { layout:"fitColumns", data:row.getData().serviceHistory, columns:[ {title:"Date", field:"date", sorter:"date"}, {title:"Engineer", field:"engineer"}, {title:"Action", field:"actions"}, ] }) }, });

https://codepen.io/ryazantsevav/pen/zYrBwyL

olifolkerd commented 4 years ago

Hey @Ruzancev

Please use the Bug Reporting Issue Template when reporting a bug, it will provide all the information we need to help you out.

Also please have a read of the Community Bug Reporting Guidelines, Large blocks of code posted into issues are very hard to read and make it hard for others to understand the issue.

Cheers

Oli :)