Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MVC jQuery Razor ASP:NET
I am trying to create a dashboard, But m having problem dragging item from one partial view to another the dragged item disappears after dragging.
 
@{
    Layout = null;
}
 
<script src="~/Scripts/jquery-1.8.0.min.js"></script>
<link href="~/Content/Stylesheets/easyui.css" rel="stylesheet" />
<script src="~/Scripts/jquery.easyui.min.js"></script>
<script src="~/Scripts/ui.droppable.js"></script>
 
<style type="text/css">
    .dragCompleted
    {
        margin-top: 5px;
        text-decoration: none;
        color: #000;
        background: #9cd86d;
        display: block;
        padding: 1em;
        /* Firefox */
        -moz-box-shadow: 5px 5px 7px rgba(33,33,33,1);
        /* Safari+Chrome */
        -webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7);
        /* Opera */
        box-shadow: 5px 5px 7px rgba(33,33,33,.7);
        border: 1px solid #ccc;
        width: 50px;
        height: 50px;
        margin-bottom: 10px;
        cursor: move;
        z-index: 999;
    }
 
    #targetareaCompleted
    {
        border: 1px solid black;
        height: 200px;
    }
 
    .proxy
    {
        border: 1px solid #ccc;
        width: 80px;
        background: #fafafa;
        z-index: 999;
    }
</style>
 
<script type="text/javascript">
    jQuery(document).ready(function () {
        $(".dragInProgress").draggable();
 
        //$(function () {
        $('.dragCompleted').draggable({
            revert: true,
            deltaX: 20,
            deltaY: 20,
            proxy: function (source) {
                var n = $('<div class="proxy"></div>');
                n.html($(source).html()).appendTo('body');
                return n;
            },
            onStopDrag: function (e, source) {
                $(this).remove();
            }
        });
        //});

        //$(function () {
        $('#targetareaCompleted').droppable({
            activate: function (event, ui) { alert('dropped');},
            onDrop: function (e, source) {
                $('.dashboardCompletedItemBody').append(" <div class="dragCompleted">" + $(source).html() + "</div>");
                $('.dashboardCompletedItemBody').find('.dragCompleted').addClass('dragCompleted');
                //$('.dashboardCompletedItemBody').find('.dragCompleted').removeClass('dragInProgress');
                $(".dragCompleted").draggable('enable');
                $(".dragCompleted").css("z-index:9999");
                $(".dragCompleted").draggable({
                    proxy: function (source) {
                        var n = $('<div class="proxy"></div>');
                        n.html($(source).html()).appendTo('body');
                        return n;
                    }
                });
               
            },
            over: function( event, ui ) { alert('dropped');}
 
        });
    });
 
</script>
 
<div class="CompletedItem">
    <div class="CompletedItemHeader" align="center">Completed</div>
    <div id="easyui-droppable targetareaCompleted">
        <div class="CompletedItemBody" align="center">
        </div>
    </div>
</div>
[Edit]Code block added[/Edit]
Posted 11-Mar-13 9:44am
Edited 11-Mar-13 9:47am
(no name)127.4K
v2

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

  Print Answers RSS
0 Mathew Soji 330
1 BillWoodruff 260
2 Sergey Alexandrovich Kryukov 240
3 OriginalGriff 216
4 Afzaal Ahmad Zeeshan 208
0 OriginalGriff 6,168
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,028
3 Manas Bhardwaj 4,539
4 Maciej Los 3,845


Advertise | Privacy | Mobile
Web04 | 2.8.1411019.1 | Last Updated 11 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100