Drag and drop problem


#1

I am working on a resource planning problem. I like to use a nice drag
and drop interface for that. E.g. have a box of persons and a box of
projects, now I would like to assign a persom to project by dragging it
from the available resources box to a recieving project box.

I have studied the amazing drag and drop shopping card code listed here
http://demo.script.aculo.us/shop

What I need to change is that the resources (products in the cart
example) should be deleted from the list of available persons after an
assignment is done (I can do a :revert => false, but that is only part
of the job.).

Even more challaging is to found a way of reassigning a resource: I
would like to get a person back from a project into the pool of
available persons again.

I tried lots of things but I cannot make the drop action (form the
shopping card div bacl into the products div) update the products div.
The cart div is the only one updated. I wonder if it is the nesting of
the divs that can make it work ? A drop on the waste bin does update the
shopping cart, also, so there should be simple trick to get the products
box to be updated also (maybe reflecting new stock levels ??)

Any hints or pointers are more then welcome,

Thanks,

Matthijs


#2

On 1/9/06, Matthijs removed_email_address@domain.invalid wrote:

example) should be deleted from the list of available persons after an
the divs that can make it work ? A drop on the waste bin does update the
shopping cart, also, so there should be simple trick to get the products
box to be updated also (maybe reflecting new stock levels ??)

Any hints or pointers are more then welcome,

Basically you have 2 boxes and you want to be able to drag-drop from one
box
to another.The first one being available resources and the second one
being
the assigned resources.Is that right?


#3

Vivek K. wrote:

Basically you have 2 boxes and you want to be able to drag-drop from one
box
to another.The first one being available resources and the second one
being
the assigned resources.Is that right?

Thats is correct, my main problem is to figure out to update BOTH boxes
on a drop event.


#4

Here you go…I couldnt figure out a simpler way other than to tinker
with
the id of the elements you want to drag and drop.
You need to modify the id’s of elements depending on which box they are
in.
I have 2 boxes a and b.the available resources and the used resources in
your case. I modify the id’s of the elements as a1,a2 and b1,b2
according to
where they are at the moment.

Hope this helps…I havent tested on IE.


#5

Hi Matthijs,
What code are you talking of ? I sent the entire HTML code .Hope you
got
that.
Vivek


#6

Vivek K. wrote:

Hope this helps…I havent tested on IE.

OK thanks I get the idea, i am now tryling implement it, could you post
the code you used for testing here, I guess that would be helpfull, also
for others reading this list.

If I manage to get it working I will also post the code for the
sollutions here.

regards, and thanks for the help so far …

Matthijs


#7

oops…I think the attachement didnt come through eariler…
I am pasting the HTML

One Two

Click here
to
know who has what