Sunday, May 19, 2024
10
rated 0 times [  13] [ 3]  / answers: 1 / hits: 18897  / 8 Years ago, thu, april 14, 2016, 12:00:00

I'm using the handsontable library for creating neat tables.

I literally copied the tutorial but the console (web developer console) gives me the following error:



Uncaught TypeError: Cannot read property 'insertBefore' of undefined            
handsontable.full.js:4471


I link both the .css and the .js file correctly in the <head> tags.



My javascript looks like this:



var data = [
[, Ford, Volvo, Toyota, Honda],
[2016, 10, 11, 12, 13],
[2017, 20, 11, 14, 13],
[2018, 30, 15, 12, 13]
];

var container = document.getElementById('temp');
var hot = new Handsontable(container, {
data: data,
rowHeaders: true,
colHeaders: true,
dropdownMenu: true
});


Html:



<div id=temp></div>


Line 4471 in handsontable.full.js is



rootElement.insertBefore(this.container, rootElement.firstChild);


The table isn't displayed, the error in the console is all I've got.


More From » handsontable

 Answers
4

It looks like that your



document.getElementById('temp');


return undefined.



Make sure that the container element is still there when Handsontable is constructing.


[#62557] Tuesday, April 12, 2016, 8 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
albert

Total Points: 652
Total Questions: 105
Total Answers: 108

Location: Pitcairn Islands
Member since Fri, Oct 15, 2021
3 Years ago
;