showing an alert when the element is dragged and placed outside of parent
Hi, I am using jquery UI to make the soting but i am missing a piece of information here when >>
1. i want to move the childrens which are inside a parent - works cool
2. I cannot move childrens to different parent, i should be able to show an alert message: - This is not working
Here is my Code:
- $('tr.childrow').mousedown(function() {
- var rowID = $(this).data('answer-id');
- siblingRow = $('tr.childrow[data-answer-id=' + rowID + ']');
- /* Hide rows that should not be sortable */
- /* Fade all nonsortable rows */
- $tableToReorder.find('> tbody > tr:not(.childrow[data-answer-id=' + rowID + '])').css('opacity', '0.5');
- $('tbody').sortable({
- items: siblingRow,
- axis: "y",
- containment: "parent",
- helper: sortableHelper,
- connectWith: "tr.childrow",
- placeholder: "sortable-placeholder",
- start: function(e, ui) {
- ui.placeholder.height(ui.helper[0].scrollHeight);
- ui.item.startPos = ui.item.index();
- notice("Sort Order Updating, Please wait...", "info");
- },
- update: function(e, ui) {
- alert("cool it works");
- }
- }).disableSelection();
- }).mouseup(function() {
- //remove all set opacity
- $tableToReorder.find('> tbody > tr').css("opacity", "");
- });