.draggable stops working after realoding list with ajax (IE7)

.draggable stops working after realoding list with ajax (IE7)

Hello,

I have built a treeview that loads its nodes via ajax. Every list-item got the classes draggable and droppable, which Im using to make the items both draggable and droppable. The code Ive written works in Firefox and Chrome, but im having troubles with Internet Explorer 7 (havnt dare to test on other versions of explorer yet).

When I make the treeview items draggable and droppable for the first time, it all works fine. But when I open a new child node, and the tree is reloded, it doesnt work to make the list draggable again. If I then try to drag the item i get an undefined error at line 5709. Im using jQuery 1.4.


The function I use to make it draggable and droppable looks like this:

function EnableDragAndDrop()
    //Fix problem with parent nodes follows its childs
    $.extend($.ui.draggable.prototype, (function (orig) {
          return {
            _mouseCapture: function (event) {
              var result = orig.call(this, event);
              if (result && $.browser.msie) event.stopPropagation();
              return result;
            }
          };
        })($.ui.draggable.prototype["_mouseCapture"]));

$('.draggable').draggable({
revert: 'invalid', 
helper: 'clone',
appendTo: 'body',
drag: function(event, ui) {            
           
        }
});

$('.droppable').droppable({
drop: function(ev, ui) {
alert('dropped');
}
});
}