Get Instances of Handsontable in jquery file

917 views
Skip to first unread message

nguyeng...@gmail.com

unread,
Mar 22, 2015, 8:10:35 AM3/22/15
to handso...@googlegroups.com
I'm init Handsontable in function,and I need get instance in other function. Can you help me?

Init :

function Init(){
hot = new Handsontable(container, {
data: data,
colWidths: [200, 200, 200],
colHeaders: ['A', 'B', 'C'],
contextMenu: false
};

}

function Rebind(){

var $container = $('#divContainer');
var ht = $container.handsontable('getInstance');
// error : ht is undefined
}

cheta...@gmail.com

unread,
Mar 25, 2015, 6:46:42 AM3/25/15
to handso...@googlegroups.com, nguyeng...@gmail.com
You have one solution you can make hot refference global and then you can use it in other function

var hot;
function Init(){
> hot = new Handsontable(container, {
> data: data,
> colWidths: [200, 200, 200],
> colHeaders: ['A', 'B', 'C'],
> contextMenu: false
> };
>
> }
>
> function Rebind(){
>
> //now you have instance directly availabe you can fire any method on it like hot.alter('remove_col', 0);
> }

mayankvadiy...@gmail.com

unread,
Feb 14, 2020, 2:55:12 AM2/14/20
to Handsontable
is It any other way to find instance or check hondsontable is already initiated?
Reply all
Reply to author
Forward
0 new messages