Jump to content

Interesting And Chalenging Question


Ajmal

Recommended Posts

Hello All, Can anyone help me. How it possible in Ajax to Drag and Drop the contents rows from main page to different folders. As in Picture shown below. Help will be appreciated. f39143559a.jpg

Link to comment
Share on other sites

It's not AJAX, it's Javascript that you would do it with. AJAX is just the combination of Javascript with the XMLHTTPRequest object to communicate with other files on the server.What you're asking for is quite complex so you better be ready to do some thinking on your own.Each row in the contacts list has to be inside an element which would have some event handlers. When the mouse is pressed down you add a mousemove event listener to the row and upon each mousemove event, update the position of the row according to how much the mouse moved based on its position. [Get mouse position]Now you need to know when the mouse is over either of the folders. There are two ways to do it: One would be to simply know the position and size of each folder and compare each of them to the mouse position upon the mouseup event, the other method would be to add event handlers to each folder and check when both the contact and the folder fire a mouseup event (I don't feel so sure about this method, there are a whole lot of events to keep track of)When the mouseup event fires on the contact, if it's over a folder, send the request to the server with AJAX to update the database and when a success response is received, delete the contact element. If the contact is not over a folder, make it return to its original position (the best way it to set "left" and "top" to empty strings and set "position" to "static") and remove the mouseover event listener.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...