Bryan Harris

Navigation

Skip navigation.

Search

Site navigation

Email conversation

FromBryan Harris
ToMe
SubjectA bit of help making a draggable table cell
Date19 October 2004 19:02
Hello!

First off let me say a big thank you for your site.  It's a fantastic
resource!  It's helped me a lot while trying to learn javascript and the DOM
and so forth.

On to the problem.  I am trying to create a table where the user can input
columns and then reorder them by dragging one cell inbetween two other
cells.  I've seen an example of this but it was rather buggy.  I searched
through your site and tried to find examples on how to make a draggable cell
but all I could find was for a layer.  I know this is pretty indepth stuff
but I was just wondering if you could point in the right direction or maybe
give me a good place to start reading about how to make this happen.  I can
get the columns added no problem.  Its just the moving and dragging that I
have no idea where to start.  Any information would be most appreciated.

Many Thanks,
Bryan
FromMe
ToBryan Harris
SubjectRe: A bit of help making a draggable table cell
Date19 October 2004 23:44
Bryan, I'm working on it - hope to have the script to do this completed tomorrow.
FromBryan Harris
ToMe
SubjectRe: A bit of help making a draggable table cell
Date19 October 2004 23:45
Whoa!  I don't know what to say.  Thank you very much.  Wow.  I can't to see
it.  Thank you so much again.
FromMe
ToBryan Harris
SubjectRe: A bit of help making a draggable table cell
Date20 October 2004 9:44
AttachmentA working version of the table column re-arrangement script
Bryan,

OK, it's done. hope this does what you need - see attached

Note, you will also need my Generic DHTML API script, as this uses a few
functions from that:
http://www.howtocreate.co.uk/jslibs/dhtmlapi.js


Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
FromBryan Harris
ToMe
SubjectRe: A bit of help making a draggable table cell
Date20 October 2004 21:51
Wow!  This is fantastic!  Thank you so much!  I was trying to do something
similar but I never thought of dynamically creating the divs.  That makes a
lot more sense.  Do you mind if a change a few things?  Only like the styles
of the div and i want to put the text from the td into the div.  Those are
things I think I can handle if its ok with you of course.  Again thank you
sooo much.  Rock on.

Thanks again,
Bryan
FromMe
ToBryan Harris
SubjectRe: A bit of help making a draggable table cell
Date20 October 2004 9:44
> Wow!  This is fantastic!  Thank you so much!

Hay, no problem at all. I like a good challenge :D

> Do you mind if a change a few things?  Only like the styles of the div
> and i want to put the text from the td into the div.

Absolutely. I wrote the script for you, you can do whatever you want with
it. I deliberately gave it a generic style to allow you to change the
styling to suit your own site.

I will be putting my copy of it online along with all everything else, so
people can always download a copy if they want.

Tarquin
FromBryan Harris
ToMe
SubjectRe: A bit of help making a draggable table cell
Date22 October 2004 21:58
I would recomend one change to the script you put on your website.  It
bugged me when I was dragging the cells, that the text would be selected.
So if you include this function:

function deselect () {
  if (document.selection)
    document.selection.empty();
  else if (window.getSelection)
    window.getSelection().removeAllRanges();
}

and then in the mouseismove function I just called the function.  It now
doesn't select any of the text which makes it a more complete app.  Again
thanks so much.

Bryan
This site was created by Mark "Tarquin" Wilton-Jones.
Don't click this link unless you want to be banned from our site.