This is a migrated thread and some comments may be shown as answers.

Drag and Drop

1 Answer 27 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rosco
Top achievements
Rank 1
Rosco asked on 29 May 2010, 09:33 AM
Can someone provide me with some help on the drag and drop javascript? I noticed that the demo has drag and drop functionality between two grids and the recycling bin icon. I just want to allow drag and drop between rows in the grid. How can I modify the javascript shown here?

http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultcs.aspx

1 Answer, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 01 Jun 2010, 10:45 AM
Hello Rosco,

You can modify the onRowDroping event handler to cancel the event if the destination is not an item in the current grid:

function onRowDropping(sender, args)
{
    var item = args.get_targetGridDataItem();
    if (!item || item.get_owner().get_owner().get_id() !== sender.get_id())
    {
        args.set_cancel(true);
    }
}

The above javascript will cancel the drop action if the destination is not a data item from the same grid you are dragging items from.

Best wishes,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Rosco
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or