Return to Snippet

Revision: 56027
at March 7, 2012 09:13 by ariskelvyn


Updated Code
//Arrastrar items
$('.supermercado div,.lista div').draggable({
    cursor: 'pointer',
    connectWith: '.lista',
    helper: 'original',
    opacity: 0.5,
    zIndex: 99,
    revert: true
});


//Reordenamiento de los items
$('.lista,.supermercado').sortable({
    connectWith: '.lista,.supermercado',
    cursor: 'pointer'
}).droppable({
    accept: '.supermercado div',
    activeClass: 'highlight',
    drop: function(event, ui) {
        var $li = $('<div value="' + ui.draggable.attr("value") + '">').html(ui.draggable.html());
        $li.appendTo(this);
        ui.draggable.hide();
        valores();
    }
});

function valores() {
    var valores = "";
    $('.lista div').each(function() {
        valores += $(this).attr("value") + ",";
    });
    $("#productos").val(valores.substr(0,(valores.length-1)));
}

Revision: 56026
at March 7, 2012 06:56 by ariskelvyn


Updated Code
//Arrastrar items
$('.supermercado div,.lista div').draggable({
    cursor: 'pointer',
    connectWith: '.lista',
    helper: 'original',
    opacity: 0.5,
    zIndex: 99,
    revert: true
});


//Reordenamiento de los items
$('.lista,.supermercado').sortable({
    connectWith: '.lista,.supermercado',
    cursor: 'pointer'
}).droppable({
    accept: '.supermercado div',
    activeClass: 'highlight',
    drop: function(event, ui) {
        var $li = $('<div value="' + ui.draggable.attr("value") + '">').html(ui.draggable.html());
        $li.appendTo(this);
        ui.draggable.hide();
        valores();
    }
});

function valores() {
    var valores = "";
    $('.lista div').each(function() {
        valores += $(this).attr("value") + ",";
    });
    $("#productos").val(valores.substr(0,(valores.length-1)));
}�

Revision: 56025
at March 7, 2012 06:54 by ariskelvyn


Initial Code
//Arrstrar items
$('.supermercado div,.lista div').draggable({
    cursor: 'pointer',
    connectWith: '.lista',
    helper: 'original',
    opacity: 0.5,
    zIndex: 99,
    revert: true
});


//Reordenamiento de los items
$('.lista,.supermercado').sortable({
    connectWith: '.lista,.supermercado',
    cursor: 'pointer'
}).droppable({
    accept: '.supermercado div',
    activeClass: 'highlight',
    drop: function(event, ui) {
        var $li = $('<div value="' + ui.draggable.attr("value") + '">').html(ui.draggable.html());
        $li.appendTo(this);
        ui.draggable.hide();
        valores();
    }
});

function valores() {
    var valores = "";
    $('.lista div').each(function() {
        valores += $(this).attr("value") + ",";
    });
    $("#productos").val(valores.substr(0,(valores.length-1)));
}​

Initial URL


Initial Description
Con esta líneas de programación, puedes crear listas Drag & Drop utilizando jQuery UI; permitiendo al usuario reorganizar los "items" seleccionados.

El funcionamiento interno, permite el envío usando un formulario ya sea por GET o POST.

Initial Title
Crear listas usando Drag & Drop y ordenarlas con jQuery UI

Initial Tags


Initial Language
jQuery