How do I drag and drop a row in a JTable?

The following allows JTable re-ordering of a single dragged row: table.setDragEnabled(true); table.setDropMode(DropMode.INSERT_ROWS); table.setTransferHandler(new TableRowTransferHandler(table)); Your TableModel should implement the following to allow for re-ordering: public interface Reorderable { public void reorder(int fromIndex, int toIndex); } This TransferHandler class handles the drag & drop, and calls reorder() on your TableModel when the gesture is completed. /** … Read more

How do I highlight a droppable area on hover using jquery ui draggable

Check out http://jqueryui.com/demos/droppable/#visual-feedback. Ex: $( “#draggable” ).draggable(); $( “#droppable” ).droppable({ hoverClass: “ui-state-active”, drop: function( event, ui ) { $( this ) .addClass( “ui-state-highlight” ) .find( “p” ) .html( “Dropped!” ); } }); $( “#draggable2” ).draggable(); $( “#droppable2” ).droppable({ accept: “#draggable2”, activeClass: “ui-state-hover”, drop: function( event, ui ) { $( this ) .addClass( “ui-state-highlight” ) .find( … Read more

D3 Differentiate between click and drag for an element which has a drag behavior

The key bit that’s missing is the check whether the default behaviour of an event has been prevented. That is, there’s a matching sibling to d3.event.preventDefault() — d3.event.defaultPrevented. You need to check this in your click handler to see whether any dragging action is going on. See also the answer to this question.

How to detect the dragleave event in Firefox when dragging outside the window

I’ve found a solution. The problem was not so much that the dragleave event wasn’t firing; rather, the dragenter event was firing twice when first dragging a file into the window (and additionally sometimes when dragging over certain elements). My original solution was to use a counter to track when the final dragleave event was … Read more

jQuery ui draggable elements not ‘draggable’ outside of scrolling div

Are you going to allow more than one instance with your draggable objects? then use the helper and append option: $(“.tag_cell”).draggable({ helper: ‘clone’, appendTo: ‘div#myHelperHolder’ }); Then in your css you can set the zindex of div#myHelperHolder to be 999. If not, then try just using the zindex option: $(“.tag_cell”).draggable({ zIndex: 999 }); I would … Read more

How do I prevent drag on a child, but allow drag on the parent?

If you want to truly cancel out the drag and make it unnoticeable to parent drag handlers, you need to both preventDefault and stopPropagation: <div draggable=”true” ondragstart=”console.log(‘dragging’)”> <span>Drag me! :)</span> <input draggable=”true” ondragstart=”event.preventDefault(); event.stopPropagation();” value=”Don’t drag me :(“> </div> Without the stopPropagation, the parent ondragstart will still be called even if the default behavior will … Read more

Angular 7 Drag and Drop – Dynamically Create Drop Zones

After a full day of research, I found this pull request on Angular CDK repository on Github. Now, since I did not know how to integrate cdkDropListGroup into my example, I decited to create an array of IDs which will be added to [cdkDropListConnectedTo]. Each instance of my second list will have generated ID, and … Read more

How can I easily duplicate the trello style of drag and drop of cards? (Kanban style app) [closed]

An upgraded version built upon Brad Parks-s answer right on this very page featuring even more indent and an awesome tilt-towards-drag-direction effect as demonstrated on this jsFiddle page. Different bits in JavaScript follow the comments: $( “.column” ).sortable({ connectWith: “.column”, handle: “.portlet-header”, cancel: “.portlet-toggle”, start: function (event, ui) { ui.item.addClass(’tilt’); // Start monitoring tilt direction … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)