views:

26

answers:

0

I had done a page for dragging a tree node from ASP.net TreeView and drop it on any portion. AND I HAVE ENABLED THE CHECKBOX IN TreeView. But I dont want to drag the parent nodes. I want only the child nodes to be dragged. How is it possible ? the jquery which I had used for dragging and dropping the node is as shown. What should I apply for restrict dragging parent node ? AND I ALSO WANT THE CHECKBOX OF THE DRAGGED NODE TO BE CHECKED ONCE I DROPPED ON THE PORTION. How is it possible ?

$(document).ready(function() {
        InitializePage();
    });

    function InitializePage() {
        //Binds the drag Event
        BindDragEvent();
        //$(".draggable").draggable({ helper: 'clone', scroll: false });

        //Binds the drop Event
        BindDropEvent();

        //AdjustCellContents();
    }

    function BindDragEvent() {

        $("#<%= treeMeasures.ClientID%> a.treeNode").draggable({
            appendTo: 'body',
            helper: 'clone',
            start: function(event, ui) {

                var previousTd = $(this).parent().prev();
                $("img", previousTd).css("visibility", "hidden");
            },
            drag: function() {
                $('#<%=hdnNodeType.ClientID%>').val("Measures");
            },
            stop: function(event, ui) {
                var previousTd = $(this).parent().prev();
                $("img", previousTd).css("visibility", "visible");
            },
            zIndex: '100'
        });

        $("#<%= treeDimensions.ClientID%> a.treeNode").draggable({
            appendTo: 'body',
            helper: 'clone',
            start: function(event, ui) {

                var previousTd = $(this).parent().prev();
                $("img", previousTd).css("visibility", "hidden");
            },
            drag: function() {
                $('#<%=hdnNodeType.ClientID%>').val("Dimensions");
            },
            stop: function(event, ui) {
                var previousTd = $(this).parent().prev();
                $("img", previousTd).css("visibility", "visible");
            },
            zIndex: '100'
        });
    }

    function BindDropEvent() {

        $(".droppable").droppable({
            drop: function(ev, ui) {
                alert(ui.draggable.text());

        });
    }