如何在列表中多重选择项目可排序拖放?

时间:2016-01-11 09:49:14

标签: javascript jquery drag-and-drop drag jquery-ui-draggable

目前我只能通过从列表中选择一个项目进行拖放,但现在我需要多选项目表单列表以便在同一列表中进行拖放。我正在使用下面的代码,任何人都可以帮助我进行多选拖放。

<script>
    document.observe('dom:loaded', function() {
        Sortable.create('sortlist', {
            tag: 'li',
            only: 'sorting',
            hoverclass: 'over',
            overlap: 'horizontal',
            ghosting: false,
            constraint: false,
            scroll: window,
            scrollSensitivity: 30,
            scrollSpeed: 25
        })

        var $isInIFrame = (window.location !== window.parent.location);
        var $window = $isInIFrame ? parent : self;
        var $buttonSave = $$('button.button-save-sortable')[0];
        var $buttonOpenNewWindow = $$('button.button-open-new-window')[0];

        $buttonSave.onclick = function() {
            new Ajax.Request("<?php echo $this->getSaveUrl(); ?>", {
                method: "post",
                evalScripts: true,
                onLoading: function() {
                    $window.$('loading-mask').show()
                },
                onSuccess: function(transport) {
                    $window.$('loading-mask').hide()
                },
                onComplete: function(transport) {
                    eval(transport.responseText)
                },
                parameters: {
                    data: Sortable.serialize('sortlist'),
                    iframe: $isInIFrame,
                    form_key: '<?php echo $this->getFormKey(); ?>'
                }
            })
        }
    })
</script>

0 个答案:

没有答案