<!doctype html>
<html lang="es">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<style>
#sortable { list-style-type: none; margin: 0; padding: 0; width: 650px; }
#sortable li { margin: 3px 3px 3px 0; padding: 1px; float: left; width: 100px; height: 90px; font-size: 4em; text-align: center; }
</style>
<script>
$(function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
});
</script>
</head>
<body>
<ul id="sortable">
<li id="1"><img src="images/foto1.jpg" style="height:100%;"></li>
<li id="2"><img src="images/foto2.jpg" style="height:100%;"></li>
<li id="3"><img src="images/foto3.jpg" style="height:100%;"></li>
<li id="4"><img src="images/foto4.jpg" style="height:100%;"></li>
</ul>
<div style="width:100%;float:left;">
<input id="btnOrdenar" type="button" value="Guardar esta ordenación">
</div>
<script>
$(function() {
/*
// para q lo haga cada vez q se mueva uno, pero esto es mortal para la BD
$("#sortable").sortable({
stop: function ( event, ui){
var arrIds = $(this).sortable('toArray');
alert(arrIds);
}
});
*/
// Que solo se ordene en BD cdo se le de al boton
$("#btnOrdenar").click(function(event, ui) {
var arrIds = $("#sortable").sortable('toArray');
alert(arrIds);
$.ajax({
...
});
});
});
</script>
</body>
</html>
Mostrando entradas con la etiqueta Jqueryui: Sortable. Mostrar todas las entradas
Mostrando entradas con la etiqueta Jqueryui: Sortable. Mostrar todas las entradas
Jqueryui: Sortable con grid
JQueryui: Datatables con sortable
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.4/css/jquery.dataTables.min.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script type="text/javascript" language="javascript" src="http://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
</head>
<body>
<table id="tablaLSG" class="table table-striped table-bordered" style="width:800px;">
<thead>
<tr>
<th>CAB 1</th>
<th>CAB 2</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
</tr>
<tbody>
</table>
<script>
$(document).ready(function() {
$('tbody').sortable();
});
</script>
</body>
</html>
Jqueryui: Sortable
$("#sortable").sortable({
stop: function ( event, ui){
var arrIds = $(this).sortable('toArray');
$.ajax({
async: false,
type: "POST",
url: "funciones.php",
data: {
accion: "reordenar",
arrIds: arrIds
},
success: function(data) {
// location.reload();
},
error: function(data){
}
});
}
});
$( "#sortable" ).disableSelection();
stop: function ( event, ui){
var arrIds = $(this).sortable('toArray');
$.ajax({
async: false,
type: "POST",
url: "funciones.php",
data: {
accion: "reordenar",
arrIds: arrIds
},
success: function(data) {
// location.reload();
},
error: function(data){
}
});
}
});
$( "#sortable" ).disableSelection();
Suscribirse a:
Entradas (Atom)
