programmatic ajax update (drag & drop but without mouse clicks)

Discussion in 'JavaScript' started by ErectADirectory, Jan 31, 2007.

  1. #1
    Got an interest program I wanted some pointers or someone to co-op with. I do php well but am not a huge fan of js, it's tough for me to switch back and forth.

    About the program . . . . The closest thing I have seen to this is a drag & drop (script.aculo.us style), but I want all the draging stuff to be handled by a js call to a db. The list would be moving without mouse intervention. So what would happen is that the web page would load and have a default order, then after the ajax -> db call was made it would re-order 1 unit at a time.

    Sound clear as mud? Any pointers or advise would be helpful.

    Thanks
     
    ErectADirectory, Jan 31, 2007 IP
  2. pbmods

    pbmods Guest

    Messages:
    18
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    So what you're saying is, when the User re-orders items in the list, the database should automatically get updated?
     
    pbmods, Feb 5, 2007 IP
  3. klown

    klown Peon

    Messages:
    2,093
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #3
    checkout the dojo toolkit it has functionality to do this, you can see it in some of their previews.
     
    klown, Feb 5, 2007 IP
  4. ErectADirectory

    ErectADirectory Guest

    Messages:
    656
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Didn't see it in the dojo kit, I have looked around script.aculo.us & sajax also to no avail. pbmods, the database pushes the reorder for the user to see, not the other way around.

    It would work like this...A database spits out some information that looks like this and loads it in a ul : li : div

    id + alpha
    -----------
    1 | a
    2 | b
    3 | c
    4 | d
    5 | e
    ----------

    At this point the page is loaded and the viewer sees the above table. Now Every 3 seconds you get an js call to a php file which returns this information

    1 | e

    This would make the li associated with alpha "e" to move up to the #1 postion (top of the list) without mouse intervention. By this I mean imagine this page (which is drag and drop) happening without you dragging and dropping. The list sorts itself right before your eyes.

    3 seconds later a js call hits a php program which returns this information

    2 | d

    As you would expect alpha "d" moves up to the #2 position right before your eyes.

    And so on and so forth until all 5 items have been rearranged and now sit at their final resting place.

    This program would have many awesome possibilities online. Imagine horse races that have the <li>'s associated with the horse names and as 1 horse moves in front of the other the list resorts itself.

    How about fantasy football contests with thousands of users that changes real time and sorts from best to worst right in front of your eyes.

    << insert your very cool trick for this here, there are tons of great things this could be used for >>

    I have other ideas for it but this would be VERY COOL way to sort things real time via a browser.

    Did I clear this up for you, any suggestions would be helpful. I just don't even know where to start. I don't have as much control of my dom as I would like.

    Thx
     
    ErectADirectory, Feb 5, 2007 IP