Table not loading with jQuery

Tags: #<Tag:0x00007efc6de97440>

Hi,

My table load with regular HTML.

var container = document.getElementById(‘example’);

var hot = new Handsontable(container, {
data: data,
minSpareRows: 1,
rowHeaders: true,
colHeaders: true,
contextMenu: true
});

But when trying to load with jQuery it does not work.

$("#example").handsontable({
data: data,
rowHeaders: true,
colHeaders: true,
contextMenu: true
});

Does anyone have suggestions for this issue?

Thanks!

Hi @rodrigo.turnes
Please check this example: http://jsfiddle.net/handsoncode/55ahgfrx/
It has the same code you provided above and it works. Maybe it is related to your script loading order?

Aleksandra,

Thanks for the response!

So, which should be the order of scripts? I am using a big solution which has a lot of loaded js files. Is there any guide for this?

Another problem that I am having is that when I load data, the table does not render until I click somewhere on the screen. I have seen some solutions but they all refer to jQuery cases. I am loading my table like this.

var container = document.getElementById(‘example’);

var hot = new Handsontable(container, {
data: data,
minSpareRows: 1,
rowHeaders: true,
colHeaders: true,
contextMenu: true
});

Any suggestions? I have checked that the container is visible but the problem is that the

and have no data.

Thanks!

Rodrigo

Hi @rodrigo.turnes
When it comes to using jQuery with Handsontable you only load jQuery first and the the .js file and the .css file after.

About the issue you described unfortunately I saw it at Github few days ago and it’s not fixed yet.