views:

304

answers:

1

I'm using jQuery UI's sortable lists to sort items in a todo list, and the reordering of the lists works like a charm.

I have several UL lists for each todo category, i.e. Design, Development, etc.

I want to be able to move an item from one category to another, and jQuery UI's sortable lists plugin allows me to do this with the connectWith option parameter.

But I can't seem to find how to update the database as well. The todo database table has a field for a reference to the category which is laying in it's own table.

This is the current code:

$('.sortable').sortable({
    axis: 'y',
    opacity: .5,
    cancel: '.no-tasks',
    connectWith: '.sortable',
    update: function(){
        $.ajax({
            type: 'POST',
            url: basepath + 'task/sort_list',
            data: $(this).sortable('serialize')
        });
    }
});

Do I need to add another value to the AJAX's data parameter, or do the sortable plugin this for me in the serialize function?

A: 

Hi.

You probably already figured it out but here is my method. (might point someone in the right direction)

I'm new to Stackoverflow and having finger trouble with formatting the code in the post. For some reason it ignores some lines when I use the code brackets. So I posted it here.

jQuery Sortable joined lists with SQL update

Quickspace