There have been many complaints about the onChange callback being broken 
in sortables posted to this list -- as well as some patches providing a 
a fix. There have been no developer responses to these posts & it looks 
like the plugins SVN repository @ jquery.org has not seen any action 
regarding this issue -- which is relatively unfortunate as this is 
perhaps the MOST IMPORTANT of the callbacks. After all, once things are 
sorted -- don't you want to save that state? :)

Anyway... I came across this issue in an effort to rid my program of all 
things prototype. For those interested, here's a easily modifiable 
(albiet kludgey) workaround;

var pommoSort = {
    init: function() {
        var s = $.SortSerialize('grid');
        this.hash = s.hash;
    },
    update: function(hash) {
        if(this.hash == hash)
            return false; // don't do a thing if unchanged...
        this.hash = hash;
       
        // call datasource updater via ajax request...
       
        return false;
    }
};

$().ready(function(){
   
    $('#grid').Sortable({
        accept : 'sortable',
        handle: '.sortHandle',
        opacity: 0.8,
        revert: true,
        tolerance: 'intersect',
        onStop: function() {
            var s = $.SortSerialize('grid');
            pommoSort.update(s.hash);
        }
    });
    pommoSort.init();
});


Also, it is of importance to remember that your "sortable" elements (be 
it LI's or DIVs -- or anything possessing the class passed as the 
"accept" parameter ["sortable" in the above case]) have a ID assigned. 
The ID is what iSort uses during serialization.

Hope this helps ... and thanks for the plugin! :)

~ Brice

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to