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

Disable Drag and Drop for specific rows

1 Answer 199 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Wolfgang
Top achievements
Rank 1
Wolfgang asked on 11 Nov 2020, 04:42 PM

Hello,

We have a gridview filled with production steps. These production steps can be reordered. For this we have implemented a behavior like the "Reorder Rows" behavior in your examples.These productions steps have a status field, that describe the step needs to be done or is done. the production steps will have to be processed from top to bottom 

The steps with status done do not need to be dragged and dropped, and the steps with status not done should never be dropped before a step with status done.

Is there a way to disable drag and drop for specific rows or cancel drop on specific rows?

Best regards and thanks for your help

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 13 Nov 2020, 12:54 PM

Hello Wolfgang,

To achieve your requirement, you can use the DragDropManager.DragInitialize event. In the behavior's event handler, you can set the Data and the DragVisual of the event arguments to null. For example:

private void OnDragInitialize(object sender, DragInitializeEventArgs e) 
{    
    // If the drag should be canceled set the data and the visual to null 
    e.Data = null; 
    e.DragVisual = null; 
} 

I hope this helps.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
GridView
Asked by
Wolfgang
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or