Aleksander Machniak
2014-07-16 3cb61e7528c2a8544083bf14e02ea4b9387671fb
program/js/treelist.js
@@ -68,6 +68,8 @@
    tree_state,
    ui_droppable,
    ui_draggable,
    draggable_opts,
    droppable_opts,
    list_id = (container.attr('id') || p.id_prefix || '0'),
    me = this;
@@ -470,7 +472,7 @@
  /**
   *
   */
  function reset()
  function reset(keep_content)
  {
    select('');
@@ -478,7 +480,22 @@
    indexbyid = {};
    drag_active = false;
    container.html('');
    if (keep_content) {
      if (draggable_opts) {
        draggable('destroy');
        draggable(draggable_opts);
      }
      if (droppable_opts) {
        droppable('destroy');
        droppable(droppable_opts);
      }
      update_data();
    }
    else {
      container.html('');
    }
    reset_search();
  }
@@ -1043,6 +1060,13 @@
  {
    if (!opts) opts = {};
    if ($.type(opts) == 'string') {
      $('li:not(.virtual)', container).droppable(opts);
      return this;
    }
    droppable_opts = opts;
    var my_opts = $.extend({
        greedy: true,
        tolerance: 'pointer',
@@ -1084,8 +1108,16 @@
  {
    if (!opts) opts = {};
    if ($.type(opts) == 'string') {
      $('li:not(.virtual)', container).draggable(opts);
      return this;
    }
    draggable_opts = opts;
    var my_opts = $.extend({
        appendTo: 'body',
        revert: 'invalid',
        iframeFix: true,
        addClasses: false,
        cursorAt: {left: -20, top: 5},