Using the HTML5 drag and drop API to create sortable table rows -


I have searched very extensively for an example, where someone uses HTML drag and drop API so that The rearrangement of table rows could be enabled. Element), but there does not seem to be any such thing. I have participated in some examples that look for the mouse cursor position, but of course it is not to take advantage of these new API incidents that seem very easy.

To date, I have ever actually seen anyone posting the order and examples using unreserved listings and list elements. How it is used in the list of their own experiments implementing draggart, drawer and drop handlers, does not work like this.

Has anyone managed to apply it to table elements, and is there an example of working with them? I know about jQuery's sorted plugin, but I'm particularly interested in the original JavaScript solution.

I apply the HTML5 drag based on the tutorial and drop it from "pocket to rect" For several days: And it works quite well.

Here's what happened to me:

Unfortunately, for this many things jQuery is required (though not the jQuery UI), for me, the closest () "And" Offset () "were my pain, I hope you can still get close to a working drag-and-drop re-arranged table. It's not complicated, but there is a ton of gadcheas.

Whatever you have to do, your implementation of your offset and jQuery Respond to this. Static. Data can be changed with DOM functions to move the dropping row to the drop-down on the item.

Honestly, if you With the very small variation that works just like the charm for the table, trim the jQuery UI, drag it with drag and drop is a terrible API, and is less consistent. Here my work is on jQuery UI Solve I have been cheated in favor of feedback:

  jQuery (function ($) {$ ('table.sortable'). Sortable ({items: ".item", axis: "y", stop: function (Event, UI) {ui.item.effect ('Highlight');}, Update: Function (Event, UI) {// Update Server here}});});  
  & lt; Script src = "https://ajax.googleapis.com/ ajax / libs / jQuery / 2.1.3 / jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Link href = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" rel = "stylesheet" /> & Lt; Script src = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js" & gt; & Lt; / Script & gt; & Lt; Table class = "sort" & gt; & Lt; TR & gt; & Lt; Th & gt; Header 1 & lt; / Th & gt; & Lt; Th & gt; Header 2 & lt; / Th & gt; & Lt; / TR & gt; & Lt; Tr class = "item" & gt; & Lt; Td> Cell 1 & lt; / Td> & Lt; Td> Cell 2 & lt; / Td> & Lt; / TR & gt; & Lt; Tr class = "item" & gt; & Lt; Td> Cell 1 & lt; / Td> & Lt; Td> Cell 2 & lt; / Td> & Lt; / TR & gt; & Lt; Tr class = "item" & gt; & Lt; Td> Cell 1 & lt; / Td> & Lt; Td> Cell 2 & lt; / Td> & Lt; / TR & gt; & Lt; / Table & gt;  


Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -