Search code examples
pluginshandsontable

How to create a plugin for handsontable


I want to create a plugin for handsontable and copied the removeRow files in extenstions subfolder to jquery.handsontable.myPlugin.[js|css]. In those files I renamed every occasion of removeRow to myPlugin and RemoveRow to MyPlugin.

In the table definition I have added myPlugin: true.

But the plugin (which still should show the column with button to delete the rows) is not called.

I have added a console.log("init (removeRow)") and console.log("init (myPlugin)") in both plugins in the init(). It seems that only the removeRow plugin is called bun not myPlugin.

Do I have to register the plugin somehow to handsontable? I assumed placing both file into the extension folder should be sufficient.

Many Thanks


Solution

  • I'm not sure what you are trying to achieve by renaming removeRow to myPlugin, but have a look at Callbacks and Handsontable.PluginHooks

    var hooks = Handsontable.PluginHooks.hooks;
    

    Use this for your plugin to add hooks