javascript - jQuery UI's Sortable update event not firing -
i'm using jquery ui's sortable , call function on update. here's code i'm trying now.
$(".sortable").sortable({ handle: '.handle' , start: function (event, ui) { console.log('started sorting ' + $(event.srcelement).index()); prev_sortable_index = $(event.srcelement).index(); $('.sortable li:not(.ui-state-highlight)').each(function () { prev_list_elements.push($(this)); new_sort_order.push($(this).index()); }); console.log(new_sort_order); } , update: function (event, ui) { alert("testing"); } });
after sorting, not receive alert message. if move 'update' above 'start', have same results. have tried adding alert start event, stop event, , update event. not errors or warnings, update event not seem fire. made sure not have preventdefault or stoppropagation interfering targeted elements.
edit: adding html
<ul class="sortable no-margin no-padding" style="list-style:none;"> <li class="item green-row"><span class="handle"><img src="~/images/handle.png" style="width:14px; margin-top:2px;" /></span> <table style="width:97%;"> <tr style="background:none;"> <td style="width:130px;">plan check fee</td> <td style="width:120px;">plan check</td> <td style="width:80px;">-</td> <td style="width:103px;">$1200.00</td> <td style="width:113px;">-</td> <td style="width:92px;">$100.00</td> <td style="width:100px;">$1100.00</td> <td style="width:88px;">$1100.00</td> </tr> </table> </li> <li class="item green-row"><span class="handle"><img src="~/images/handle.png" style="width:14px; margin-top:2px;" /></span> <table style="width:97%;"> <tr style="background:none;"> <td style="width:130px;">plan check fee</td> <td style="width:120px;">plan check</td> <td style="width:80px;">-</td> <td style="width:103px;">$1200.00</td> <td style="width:113px;">-</td> <td style="width:92px;">$100.00</td> <td style="width:100px;">$1100.00</td> <td style="width:88px;">$1100.00</td> </tr> </table> </li> </ul>
i able solve issue, , turns out conflict in javascript references. used jquery.sortable.js, went using sorting functionality of jquery ui's sort, failed remove reference jquery.sortable.js.
Comments
Post a Comment