Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to get an instance of SlickGrid from an element

Just starting to use SlickGrid and it doesn't seem to initiate itself like a normal jquery widget/plugin does where you can access the instance attached to the element by just doing $(element).slickgrid() .

Is there a way to get a hold of the existing instance, without obviously holding onto it when you create it? Looking through the code it didn't seem like it, but wasn't sure if anybody else had run into this.

Not exactly sure why they took dependencies on jquery but decided to have a custom initialization.

Could be as simple as just wrapping it in a jqueryui widget.

like image 474
Greg Roberts Avatar asked Apr 06 '11 22:04

Greg Roberts


1 Answers

You could always use jQuery's data function to save a reference to the slick grid instance.

For example:

var grid = new Slick.Grid(container,data,columns,options);
$(element).data('slickgrid', grid);

And you can access it using:

$(element).data('slickgrid');
like image 125
Mark Brown Avatar answered Sep 22 '22 17:09

Mark Brown