ludo / jquery-treetable

jQuery plugin to show a tree structure in a table
http://ludo.cubicphuse.nl/jquery-treetable
GNU General Public License v2.0
741 stars 278 forks source link

Use javascript closure? #138

Closed lramarojaona closed 10 years ago

lramarojaona commented 10 years ago

Hi!

I'm trying to use this plugin in Drupal (7.x) which comes with jQuery 1.4 out-of-the-box. jquery-treetable plugin needs a more recent jQuery version (could you tell me which version is needed?).

The common way to handle this in Drupal is to load both jQuery library versions and assign them to two different objects : jQuery() and e.g. jq1102().

Then when a custom script could then use one or the other version like this:

(function($){
  $('#my_table').mysuperplugin();
})(jq1102);

However to make this work with jquery-treetable, I believe you should use javascript closure and especially avoid following line: $ = jQuery;

I'm not quite an expert in javascript but I believe using this should work:

(function ($) {
  // treetable code here...
})(jQuery);

Do you have any thoughts about that?

Thanks!

ludo commented 10 years ago

Thanks, I think you are right. The current structure is a leftover from when CoffeeScript was used. I'll update the code!

could you tell me which version is needed?

Currently the minimum version of jQuery required is 1.6 (see dependencies listed on http://plugins.jquery.com/treetable/)

lramarojaona commented 10 years ago

Great! :)

I'll bring you feedback as soon as I test it.