【问题标题】:Move items from one sortable connected list to the other programmatically以编程方式将项目从一个可排序的连接列表移动到另一个
【发布时间】:2015-08-19 12:41:53
【问题描述】:

我有两个可排序的连接列表#left#right。单击按钮时,我想将所有元素从 #left 移动到 #right

$('#left li').each(function()
{
    var $this = $(this);
    $this.appendTo('#right');
});

上面的函数移动项目,但receive函数没有被触发。

当前状态的JSFiddle

【问题讨论】:

    标签: jquery-ui triggers jquery-ui-sortable


    【解决方案1】:

    找到了手动触发receive事件的方法

    $('#left li').each(function()
    {
        var $this = $(this);
        $this.appendTo('#right');
    
        // Trigger
        $('#right').sortable('option', 'receive')(null, { item: $this });
    });
    

    JSFiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-02-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多