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

[Solved] RadGrid Custom Dragged Item

2 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kai
Top achievements
Rank 1
Kai asked on 27 Aug 2009, 01:42 PM
Is there a way to change the dragged item for a RadGrid Control?  I currently have a RadGrid with a Template Column.  In this template column, I have a server control in it.  I want it so that when I drag that row, I don't see the entire control in my template column.  This is the row that is following the mouse when you do the dragging.  It would be much better if I could change that to show maybe just a row of text instead.

Kai Thao

2 Answers, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 01 Sep 2009, 08:29 AM
Hello Kai,

Unfortunately, RadGrid does not support styling of the dragged items. What you can do, however, is attach to RadGrid's OnRowDragStarted event and hide the cell that contains your template controls. Then use setTimeout() to show the cell back. The net effect is that you get your templated cell removed from the dragged item. Here is an example:

function rowDragStarted(sender, args) 
    var table = args.get_tableView(); 
    var items = table.get_dataItems(); 
    var index = args.get_itemIndexHierarchical(); 
    var thisItem = items[index]; 
 
    thisItem.get_cell("Value").style.display = "none"
    setTimeout(function() 
    { 
        thisItem.get_cell("Value").style.display = ""
    }, 0); 

In the above method, "Value" is the name of the template column that we wish to hide from the dragged items. Try this out.

Sincerely yours,
Veli
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kai
Top achievements
Rank 1
answered on 01 Sep 2009, 01:13 PM
Thanks.  This works perfect and it still gives me room to customize the dragged rows.

Kai Thao
Tags
Grid
Asked by
Kai
Top achievements
Rank 1
Answers by
Veli
Telerik team
Kai
Top achievements
Rank 1
Share this question
or