Sortable Jquery table not working in new Jquery version -
i have table sorting function jquery version jquery-1.7.2. when upgrade jquery jquery-1.11.1 sorting function not working. how can solve this?
here html code
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> <script src="http://code.jquery.com/jquery-1.7.2.js"></script> <script src="http://code.jquery.com/ui/1.8.18/jquery-ui.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <table id="sort" class="grid table-bordered table-striped" title="kurt vonnegut novels"> <thead> <tr><th class="index">no.</th><th>year</th><th>title</th><th>grade</th></tr> </thead> <tbody> <tr><td class="index">1</td><td>1969</td><td>slaughterhouse-five</td><td>a+</td></tr> <tr><td class="index">2</td><td>1952</td><td>player piano</td><td>b</td></tr> <tr><td class="index">3</td><td>1963</td><td>cat's cradle</td><td>a+</td></tr> <tr><td class="index">4</td><td>1973</td><td>breakfast of champions</td><td>c</td></tr> <tr><td class="index">5</td><td>1965</td><td>god bless you, mr. rosewater</td><td>a</td></tr> </tbody> </table>
here js
<script> 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(); </script>
you using onl jquery.ui.min.js
file if upgrade jquery.min.js
have upgrade jquery.ui.js
file try replace file this:-
<script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
and here :-demo
Comments
Post a Comment