jQuery Sortable Events - undefined parameters

566 views Asked by At

i'm in litle trouble triing to obtain information about events fired by jQuery sortable.

I have this code working :

var sortable = $("#datatable-wrapper #example tbody").sortable({
        cursor: "move",
        tolerance: 'pointer',
});

sortable.bind( "sortout",function(e, ui) { 
        for(i in e)
             alert("e."+i+" : " + e.i);
        for(i in ui)
             alert("ui."+i+" : " + ui.i);
        for(i in this)
             alert("this."+i+" : " + this.i);
        for(i in $(this))
             alert("$(this)."+i+" : " + $(this).i);
});

The problem is : I always get something like :

e.SomeProp : undefined //same for ui, this, and $(this)

It shows me the structure of these objects, but none of these propertys are defined. What did I do wrong ?

Thanks by advance.

1

There are 1 answers

0
DarthJDG On BEST ANSWER

Your loop puts the properties' name into the i variable as a string, but you're trying to access literally e.i, not the named property, and that IS undefined. Try e[i] to access the object property by its name.