I was having the same problem. I found out that the problem wasn't really the fact that it wasn't calling onChange() on the first change but rather that it calls onChange with those changes on the next successive change.
Say I started with a list: Item 1 --- Item 2 --- Item 3 --- Item 4 --- Item 5 If i were to initially drag "Item 1" and drop it between "Item 4" and "Item 5," onChange is not called and the following list results: Item 2 --- Item 3 --- Item 4 --- Item 1 --- Item 5 Then, if I drag "Item 2" and drop it between "Item 1" and "Item 5," onChange is called but with the serialized list of "2, 3, 4, 1, 5" despite the fact that the resulting list is: Item 3 --- Item 4 --- Item 1 --- Item 2 --- Item 5 The reason for this is because the check() method in the iSort class calculates whether a change has been made before it applies the current change, which was effected by dropping the item, to the DOM. This order causes the onChange method to be called a change late because, to it, the change hasn't technically happened yet. Trying to work out in my mind exactly how this method works is proving to be rather difficult, but I did manage to fix the bug by simply moving the code segment that applies the change to the DOM up above the segment that calculates whether a change has been made. Here are the two modified files (the source code file and the packed file, respectively): http://www.nabble.com/file/6224/isortables-src.js isortables-src.js http://www.nabble.com/file/6225/isortables-packed.js isortables-packed.js That fix has worked for me, and hopefully it will help you out too. I'm also going to post this bug and the accompanying fix to the jQuery forum. wgpubs wrote: > > For some reason, the onchange event does not fire the first time the order > of elements is changed. > > Is this a bug? Or am I missing something? See attached html. > > Thanks - Wayde > -- View this message in context: http://www.nabble.com/Interface-Sortable---onchange-not-firing-first-time-tf3138013.html#a8780169 Sent from the JQuery mailing list archive at Nabble.com. _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
