将标签拖放到表格中,标签应在其原始位置

时间:2019-05-03 04:24:36

标签: javascript jquery html-table drag-and-drop label

我有一系列标签,我想将标签拖放到表格列中。

  • 条件1-标签不应丢失其原始位置
  • 条件2-如果表列中存在数据,则拖动的标签应附加标签ID,并附加在标签上
  • 条件3-重复的项目不应放在表格列中
  

Screen Print

我希望应该将David simmons标签拖放到经理行的Userinfo列中。我希望其他标签也应该拖放而不重复项目。标签不应失去其原始位置

$(function() {

 $('.lblEmail').draggable({
        cancel: "a.ui-icon", // clicking an icon won't initiate dragging
        //revert: "invalid", // when not dropped, the item will revert back to its initial position
        revert: true, // bounce back when dropped
        helper: "clone", // create "copy" with original properties, but not a true clone
        cursor: "move"
        , revertDuration: 0 // immediate snap
    });

 // $(".lblEmail").draggable();
  $(".tableDroppable tbody tr td").droppable({
    accept: ".lblEmail",
    drop: function(e, ui) {
    var $item = ui.draggable.clone();
    $(this).addClass('has-drop').html($item);
    }
  });
});

0 个答案:

没有答案