I've installed the Handsontable package from atmosphere, and defining tables works fine in my app except for when I try to create a custom cell renderer.
The offending code in defining the table is this column definition:
{
type: {
renderer: function(instance, td, row, col, prop, value, cellProperties) {
Handsontable.TextCell.renderer.apply(this, arguments);
$(td).css({
background: 'yellow'
});
}},
//format: '0, 0.00 $',
readOnly: true
}
Anytime I try to make a Hansontable call like the Handsontable.Textcell.renderer.apply above, Meteor throws this error:
Exception from Deps afterFlush function: ReferenceError: Handsontable is not defined
I did read that Handsontable uses Jquery 1.9, but Meteor is bundled with 1.8. Could this be an issue?
Every example I see of custom cell renderers in Handsontable is similar to what I have so I'm a pretty lost on what the problem is. I also created a custom package of Handsontable with the latest version and that didn't help either.
Would love any help. Thanks!
This is likely a bug in the Handsontable package.
This line: https://github.com/olragon/meteor-handsontable/blob/master/lib/jquery.handsontable.full.js#L13
var Handsontable = {
should be
Handsontable = {
In meteor files are variable scoped. If you use the var
keyword then other files can't access it. This is part of the reason you get the Handsontable is not defined
error
You also have to export it by adding the line below after https://github.com/olragon/meteor-handsontable/blob/master/package.js#L6
api.export("Handsontable");
So that the api is exposed out of the package.
I have made a pull request so the package maintainer needs to accept it and update the package on atmosphere then you can run mrt update
and use your code as you are using now.
If you are in a rush you could fork the package with the updates and use that as your Handsontable
package