有没有办法从元素中获取SlickGrid的实例
刚开始使用 SlickGrid ,它似乎并不像普通的jquery小部件/插件那样自我启动你只需要执行$(element).slickgrid()就可以访问附加到元素的实例。
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.
不完全确定为什么他们依赖于jquery但是决定进行自定义初始化。
Not exactly sure why they took dependencies on jquery but decided to have a custom initialization.
可能就像将它包装在jqueryui小部件中一样简单。
Could be as simple as just wrapping it in a jqueryui widget.
您总是可以使用jQuery的数据函数来保存对光滑网格实例的引用。
You could always use jQuery's data function to save a reference to the slick grid instance.
例如:
var grid = new Slick.Grid(container,data,columns,options);
$(element).data('slickgrid', grid);
您可以使用以下方式访问它:
And you can access it using:
$(element).data('slickgrid');