HandsonTable setup issue

Hi,

I am very new to Jquery and I need to setup basic HandsonTable in our project.
We downloaded the “handsontable-master.zip” file and uploaded this to our server. We did not install using “bower” tool but just uploaded the folder on the server.

Then we added the references and code as mentioned in the following doc link:
https://docs.handsontable.com/0.20.3/tutorial-quick-start.html

But when we load the page, we see following error:

SCRIPT5007: Unable to get property ‘insertBefore’ of undefined or null reference

Are we missing any file references which are not mentioned in the document?
The doc lists only 2 files to be added: handsontable.full.css & handsontable.full.js

Please help us.

Thank in advance.

Hi,

are you using jQuery in your project? We use to use it but since few versions back we became jQuery-free.

It looks like your Handsontable instance is defined (js code is being injected and loaded in the right place). You should check your scripts order.

Here is my complete code:

link rel=“stylesheet” media=“Screen” href="/src/hotable/dist/handsontable.full.css">
script src="/src/hotable/dist/handsontable.full.js">

script type=“text/javascript” charset=“utf-8”>
var data= [
["", “Ford”, “Volvo”],
[“2014”, 10, 11],
[“2015”, 50, 51]
];
var container = document.getElementById(“hotsheet”);
var hot = new Handsontable(container, {
data: data,
minSpareRows:1,
rowHeaders: true,
colHeaders: true,
contextMenu: true
});
/script>

div id=“hotsheet”>

We are experiencing following error:
SCRIPT5007: Unable to get property ‘insertBefore’ of undefined or null reference
handsontable.full.js, line 4049 character 3

Any help is appreciated.
Thanks in advance.

Hi @aalap_sharma, this kind of error occurs when first argument passed to the Handsontable isn’t element. You should try to retrieve element (#hotsheet) before it’s created. Try to move div#hotsheet before script tag.

Moved the DIV to before Script and the issue got resolved. Thank you all.

How can we save the data in sheet to javascript variables? I could not find this in document.

Thank you.

To save data to variable you can use getData() method see http://docs.handsontable.com/0.21.0/Core.html#getData.

1 Like