Click here to Skip to main content
16,020,459 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
actually i have representing data in html tables in asp.net
i have more than two tables with same class names..my requirement is i have to drag and drop the table row in the particular table.. by using the following jquery function am implementing that, but my problem is that it is allowing to drop in the next table also bcoz class name is same..i wanted to drag and drop in the same table how?
JavaScript
<$(function() {
$(".coursetr").draggable({
        helper: "clone",
        revert: "invalid",
        refreshPositions: true
    });
    $(".coursetr").droppable({
    accept: ".coursetr",
    //placeholder: ".HeaderHomeActive",
        activeClass: "ui-state-hover",
        hoverClass: "ui-state-active",
        drop: function(event, ui) {
            var draggable = ui.draggable, droppable = $(this),
            dragPos = draggable.position(), dropPos = droppable.position();
            draggable.css({
                left: dropPos.left + 'px',
                top: dropPos.top + 'px'
            });
            droppable.css({
                left: dragPos.left + 'px',
                top: dragPos.top + 'px'
            });
            var t1 = $(droppable).data('courseid');
            var t2 = $(draggable).data('courseid');
            draggable.swap(droppable);
          
        }
    });
});
Posted
Updated 16-Apr-12 20:45pm
v2

1 solution

JavaScript


C#
var t1 = $(droppable).data('id');
          var t2 = $(draggable).data('id');
if (t1 =t2)
{
          draggable.swap(droppable)

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900