Task predecessor/dependencies logic for task management application
I'm trying to figure out the logic for creating tasks that have dependencies. In short I'm building a dynamic task management system and each tasks has several options one of them is to have the task start after a predecessor.
Users can add/remove/re-order (by drag&drop) tasks so I'm wondering how can I make the predecessors dynamic, here's an example of what I mean
- Task 1
- Task 2
- Task 3 -> dependent of task 2
- Task 4 -> dependent of task 2
Tasks get renamed on delete and/or re-order. If task 1 gets deleted then 3 and 4 should become dependent of task 1 (which is the old task 2). I've been banging my head for the past few hours trying to figure out how to do that.
I'm using jQuery right now and each task is contained in a div w开发者_开发技巧ith an incremental id (ie id="task1") that gets renamed whenever a task is removed or re-ordered and I'm using a dynamically populated drop down for selecting a predecessor.
What would be the easiest way to get this done??
by the way, I'm not necessarily asking for code, just trying to figure out the best way to tackle this
Make the order separate from the task id.
- Order 1: Task 1
- Order 2: Task 2
- Order 3: Task 3 -> dependent on task 2
- Order 4: Task 4 -> dependent on task 2
After deleting task 1, it becomes...
- Order 1: Task 2
- Order 2: Task 3 -> dependent on task 2
- Order 3: Task 4 -> dependent on task 2
精彩评论