hummingbird-dev / hummingbird-treeview

A powerful and fast jQuery treeview plugin
MIT License
62 stars 23 forks source link

Unable to configure treeview with an options argument #13

Open Goswinus opened 5 years ago

Goswinus commented 5 years ago

I have two treeviews on a single page and want 1 with and 1 without checkboxes.

When I call $('#treeview').hummigbird({checkboxes: 'disabled'}) the function does not process the passed options at all.

This is caused by the following check (on line 167 of hummingbird-treeview.js): typeof(methodName) == "undefined"

As a result of this check, the passed object is completely ignored. A possible workaround is changing the default options before and/or after the function call, but that's a little crude.

One of the solutions to fix this issue is to change that line to typeof(methodName) !== "string"

hummingbird-dev commented 5 years ago

Options cannot be set this way. Please check the README. Options have to be passed before the initialization like this: $.fn.hummingbird.defaults.option=value; In your case you have to use: $.fn.hummingbird.defaults.checkboxes= "disabled";