Drag and Drop

Drag and Drop

XstreamINsanityXstreamINsanity Posts: 23Questions: 0Answers: 0
edited August 2010 in General
I see a post out there about drag and drop columns and one about drag and drop rows (not finished yet), but does anyone know of a way to drag and drop rows to other items on a page. This would essentially be the same as dragging and dropping items from a collection list into a trash bin. That's the functionality I'd like to accomplish if possible. Thanks.

Replies

  • ruzzruzz Posts: 49Questions: 0Answers: 0
    Have you tried jQueryUI?

    Once you've installed take a look in jQueryUI/development-bundle/demos/draggable/default.html

    It says: "Enable draggable functionality on any DOM element"

    Any DOM element is pretty much all-encompassing, right? Lemme know how you get on because I'm heading in that direction with my app too.

    ruzz
  • XstreamINsanityXstreamINsanity Posts: 23Questions: 0Answers: 0
    I'll try that sometime this weekend. I tried some regular javascript a couple of days ago and that was not fun. Mind you, I'm more of a desktop programmer. Only within the last two months have I done any browser programming. However, I know of a website that I SERIOUSLY want to remake for my own sake and if I make it to where I like it, I'll ask other people who use the site and determine if I should put it out there. :) But that site could operate 1000000000000000 times better (ok over exagerated, lol). But the site has been up since 8/08 and whenever an error occurs, it keeps a count and displays it. Well, there are maybe 1,000 users on the site, to my knowledge, and the error count is already near 2 million. There are times when trying to do something on the site I might add 5 error codes in a minute. Yeah, it somewhat has to do with their server set up, but it's more than that, I know it is. So I want to work on my own and see if I can make it better, than get people to use it and try to bog it down. :) But I'll let you know how it goes. I just thought Allan might have already had a trick up his sleeve on the dataTables. :)
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    I'm afraid not :-). Drag and drop isn't something I've done much work with for DataTables. There are plug-ins I want to work on which will allow this, such as the column re-ordering you point out, but just not managed to get to the point yet. Like ruzz, I'd suggest just poking around with jQuery UI, which makes drag and drop so much easier than doing it from scratch.

    Regards,
    Allan
  • XstreamINsanityXstreamINsanity Posts: 23Questions: 0Answers: 0
    Ok, I shall try this. Didn't get a chance to this weekend, finally relaxing. :)
  • gilliangillian Posts: 1Questions: 0Answers: 0
    I recently developed an implementation of drag and drop columns for DataTables (using jQuery UI).

    The main trick with dragging/dropping when tables are involved is in the helper. You will need to develop a custom helper that clones the row you want to drag, so that it looks more realistic.

    It doesn't sound like you are modifying the order of rows in the table, so you won't have to deal with reordering the DataTables internal data. Just call fnDeleteRow in your drop callback (if you are implementing a "trash can" feature, that is).
  • UPEngineerUPEngineer Posts: 93Questions: 0Answers: 1
    gillian,

    Can you post how you implemented this? I have been trying but so far, no luck.
This discussion has been closed.