Jquery UI - 可在 Div 之间而不是 Div 内排序

Jquery UI - Sortable between the Div not Within Div

我有 'N' 个起始行(红色边框) 我想要可排序的(数字框 1、2、3 等)表格开始行(红色边框)接收行(绿色边框)。

sortable 不应在起始行(红色边框)内工作。 并且在接收行(绿色边框)内可排序必须有效。

注意:这里我只想禁用/取消起始行(红色边框)内的可排序功能。 下面使用了脚本代码。

    $('.draggable-row').sortable({
     connectWith:".sortable-row"

         });

     $('.sortable-row').sortable({
     connectWith:".sortable-row"

     });

Demo

您可以使用 beforeStop 事件 Sortable ,

 beforeStop: function (event, ui) {
        //$(ui.placeholder).parent()[0] gives target sort element
        //If this is current element revert sort
        if ($(ui.placeholder).parent()[0] == this) {
            $(this).sortable('cancel');
        }
    }

working Fiddle

希望对您有所帮助。