tags:

views:

728

answers:

2

I am building a todo list application for one of my projects and I am creating multiple todo lists dynamically from the database and each todo list will have multiple todo items. The items will be constrained to their own list and will not be able to be connected to another list.

I've done a single sortable list in jquery before, but I am having a hard time wrapping my head around how to write DRY code, so I am not repeating myself for each new todo list a user creates. Since the jquery code will have to figure out how many todo lists there are, and then manage each one.

Anybody know how to go about doing this or could you talk through it with some pseudocode or an example would be great.

Thanks

A: 

To be DRY in jQuery, you want to write plugins, or use an existing plugin such as Tablesorter.

jonstjohn
Thanks for the response, but using Tablesorter has nothing to do with my question does it? I agree a plugin, would be a nice solution, but I am looking for how I should write it.
Joe
perhaps you could provide more information. It sounded like you were looking to do multiple sortable todo lists. A few people thought that you were looking for a sortable solution.
jonstjohn
+1  A: 

What's wrong with using the jQuery sortable plugin and just doing something like

$(document).ready(){
    $('ol, ul').sortable(); //make every ordered and unordered list sortable
});
Steerpike
good call, then I can just grab the id of ul so I know the parent...thanks!
Joe