Oz Web Services
  • Home
  • WP
  • PHP
  • JS
  • CSS
  • SCSS
  • HTML
  • XML
  • JSON
  • SQL
  • .htaccess
  • Apache
  • Nginx
  • INI
  • HTTP
  • Diff
Search shortcode

jQuery UI: Sortable

May 23, 2014
From: http://jsfiddle.net/pmw57/tzYbU/205/ HTML that goes with it: jQuery UI: Sortable (HTML)
var fixHelperModified = function(e, tr) {
	var $originals = tr.children();
	var $helper = tr.clone();
	$helper.children().each(function(index) {
		$(this).width($originals.eq(index).width())
	});
	return $helper;
},
updateIndex = function(e, ui) {
	$('td.index', ui.item.parent()).each(function (i) {
		$(this).html(i + 1);
	});
};
$("#sort tbody").sortable({
	helper: fixHelperModified,
	stop: updateIndex
}).disableSelection();
Oz Web Services
Copyright © 2015-2025 All Rights Reserved