Question

I'm trying to make a drag and drop shopping cart for one of my clients.

http://jsfiddle.net/jfvandekamp/bkw5p/1/

I use this version as the basis: http://www.jeasyui.com/tutorial/dd/dnd2_demo.html

Since this version has no remove button i tried adding it myself. This is where the trouble started.

I managed to get a remove button behind the item which (via javascript function) removes the parentNode TR (doesn't work in the jsfiddle version for some reason). This however is not the solution since when i drag another item in the cart the item pop back up again. Also when i remove an item the total still isn't adjusted since i just removed the table row.

Anyone knows a solution for this problem? I think it should be somewhat similar to the addProduct function

Looking forward to any reply

Kind Regards

Was it helpful?

Solution

Here's an implementation that I came up with using knockout.

http://jsfiddle.net/makotosan/bkw5p/5/

It allows me to keep the markup in the HTML and not have any in the JavaScript.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top