Adding Logic to Drag and Drop

J

javascript

I am currently using the Drag & Drop library that the following demo is
based on:

http://cyberdummy.co.uk/test/dd.php ( FORM Update version )

What I am trying to do is upgrade this script in what I think would end
up being a trivial manner. Let me first draw out a visual.

Imaging 5 columns on the screen:
Colum1, Column2, Column3, Column4, Column5

Then 2 rows:
1 (primary key), 1, 2, 3, <null>
2 (primary key), 4, 5, 6, <null>

so my table looks like:

1 1 2 3 -
2 4 5 6 -

Right now I am able to drag and drop all the rows except for the
primary key field (by design!). So the table above could look like:

1 4 2 3 -
2 1 5 6 -

or

1 4 3 2 -
2 5 1 6 -

etc...

Now what I am trying to do is add a bit of logic to the dragging and
dropping event. What I plan on doing is upgrading my form to add a 6th
column that contains a textbox / label that will show a value.

My new layout will look like the following:

Column1, Column2, Column3, Column4, Column5, Column6
1 (primary key), 1, 2, 3, <null>, [TEXTBOX_1]
2 (primary key), 4, 5, 6, <null>, [TEXTBOX_2]

Now here's the kicker. To keep it simple let's say that I want
TEXTBOX_1 and TEXTBOX_2 to display the sum of each column (non-null) in
the row. On first load the table will look like:

1 1 2 3 - 6
2 4 5 6 - 15

Then I swap 4 and 1 to get:

1 4 2 3 - 9
2 1 5 6 - 12

My main question is this: Is this possible? I guess that would be a
start. If it is how should I go about accomplishing this? Are there
libraries (FREE) that accomplish this functionality that I can simply
retrofit for my application?

I'm not looking for someone to write this for me. Simple suggestions
and starting points would be more than helpful. Thanks in advance.

- will
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top