JavaScript jQuery UI - Drag and drop sorting and revert jquery drag drop file upload,jquery drag drop list,jquery

Please find this jsfiddle I've created drag n drop no sorting

The problem here is that when I put the box from drag-gable area to "drop here" area, the boxes won't be sorted out. For example If I put box2 on "drop here" area, there should not be space remain between box1 and box3. And when I put box2 back to drag-able are it should in between box1 and box3.

I've tried to sort out in drop event of draggable area.

The second problem is the box must revert back to the draggable area only if it dropped other than "drop here" area. But here it works partially. If I drag a box from "drop here" area and put outside it, it reverts back to "drop here" area. I want it to go back to drag-able area.

Here is my code:

$(function(){

  //$("#eventlist").sortable({connectWith: "#timeline"});
  //$("#timeline").sortable({connectWith: "#eventlist"});

  $(".ui-draggable").draggable({ 
      cursor: "move", cursorAt: { top: -5, left: -5 },
      //snap: " #eventlist", snapMode: "inner"
      revert: "true"      
  });

  $("#eventlist").droppable({
      accept: ".ui-draggable",      
      tolerance: 'fit',
      drop:function(event, ui){
        $("#eventlist").sortable()  ;
      }
  });

  $("#timeline").droppable({
      accept: ".ui-draggable",      
      tolerance: 'fit',      
      drop: function( event, ui ) {
        console.log(':::dropped on timeline:::');        
      },
      out: function( event, ui ) {
        $(".ui-draggable").draggable('option','revert','invalid');        
      }
  });
  });

How do I sort the boxes when it comes back to drag-able area ??? and how the box revert back to its original (the initial) position ???

Answer:1

Please find this solution: sorting at one side only

Still there is a problem. When I drop an element, I goes to the start of the drop area if it's empty. I am not able to drop it anywhere in the area.

$(document).ready(function () {
    $('#eventList, #timeLine').sortable({
        connectWith: '.initBox',        
        //Whenever Dropped Item
        receive: function (event, ui) {

       if ($(this).attr('id') != 'timeLine') {            
        $(this).find('div.boxes').sort(sortAlpha).appendTo(this);  
            if ($(this).children().length > 5) {
                if ($(this).attr('id') == 'timeLine') {
                    $(ui.sender).sortable('cancel');
                }
            }
        }
        }
    });

    function sortAlpha(a,b){  
        return a.id.toLowerCase() > b.id.toLowerCase() ? 1 : -1;  
    }

});

How do I make it to drop anywhere in drop area ?????

Answer:2

I have some replaying functionality working by using Javascript and the window.onload function. However when I go to some other page and then come back to the web application (with the onload ...

I have some replaying functionality working by using Javascript and the window.onload function. However when I go to some other page and then come back to the web application (with the onload ...

when i wrote in my "npm cache clean" this error is occurring "npm ERR! Windows_NT 6.3.9600 npm ERR! argv C:\iaAC>npm cache clean npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\...

when i wrote in my "npm cache clean" this error is occurring "npm ERR! Windows_NT 6.3.9600 npm ERR! argv C:\iaAC>npm cache clean npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\...

I'm populating my CodeMirror textarea with an unformatted string of CSS. I have no control over the formatting of this CSS. Unformatted CSS example position: absolute; top: 66px; left: 746px; width: ...

I'm populating my CodeMirror textarea with an unformatted string of CSS. I have no control over the formatting of this CSS. Unformatted CSS example position: absolute; top: 66px; left: 746px; width: ...

  1. codemirror auto format
  2. codemirror auto format code
  3. codemirror auto format json
  4. codemirror auto format all
  5. codemirror auto format xml
  6. codemirror auto indent

I'm very new to Appcelerator titanium studio. Could you please help me out how to call webservice (Java Based) in Appcelerator titanium.

I'm very new to Appcelerator titanium studio. Could you please help me out how to call webservice (Java Based) in Appcelerator titanium.

  1. calling restful web services from postgresql procedure/function
  2. calling restful web services in reactjs
  3. calling restful web services in java
  4. calling restful web service from pl/sql
  5. call restful web services from mysql
  6. calling rest web services from salesforce
  7. calling restful web service from soapui
  8. calling rest web services from javascript
  9. calling restful web service
  10. calling rest web service using mule studio
  11. call restful web service java client
  12. calling rest web service from python
  13. calling rest web service from node.js
  14. calling rest web service from jsp example
  15. calling rest web service from vb.net
  16. calling rest web service from angularjs
  17. calling rest web service from shell script
  18. calling rest web service from c#
  19. calling rest web service using jquery
  20. calling rest web service using httpclient