简体   繁体   English

使用 Javascript 在表格上拖动 HTML 单元格

[英]Dragging HTML cells over the table using Javascript

Folks,各位,

I need a solution that allows drag-and-drop cell over the table.我需要一个允许在表格上拖放单元格的解决方案。

The cells can be of different colspans, so when the cell is dropped into the middle of another cell, which is bigger, the following steps should be performed:单元格可以是不同的colspan,所以当单元格被放到另一个更大的单元格中间时,应该执行以下步骤:

  1. Another td element is created, which is equal in width to the draggable element.创建了另一个 td 元素,它的宽度与可拖动元素的宽度相等。
  2. Cells on left and right of new td element automatically adjust their width.新 td 元素左侧和右侧的单元格会自动调整其宽度。

Now I use JQuery drag-and-drop plug-in.现在我使用JQuery拖放插件。 It allows to drag elements, but becomes a bit awkward when it comes to manipulating DOM elements on the part of droppable element.它允许拖动元素,但在可放置元素部分操作 DOM 元素时变得有点尴尬。

Could anybody propose some library where this kind of behaviour is implemented?有人可以提出一些实现这种行为的库吗?

DragTable可能是一个很好的起点。

Not sure if it supports tables, but I have used link text before and it worked fairly well for me不确定它是否支持表格,但我以前使用过链接文本,对我来说效果很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM