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

How to make Drag and Drop cell Item in GridView

1 Answer 118 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Myo
Top achievements
Rank 1
Myo asked on 21 Apr 2014, 02:35 PM
Hi,
Anybody can help me how to make drag and drop cell inside grid view? I would like to publish my sample code. I appricate any help or any tutorial.

Script.
function AssignDragandDrop() {
                $telerik.$('.RmEmtpyRoom').each(function () {
                    $telerik.$(this).droppable({ drop: celldrop });
                });
                $telerik.$('.RmReservation').each(function () {
                    $telerik.$(this).draggable({ helper: 'clone' });
                });
            }
            function celldrop(e, a) {
                //var oWnd = radopen(null, "winMove");
                var targetCell = $telerik.$(this);
                var targetCellIndex = targetCell.context.cellIndex;
                var targetRow = targetCell.context.parentElement;
                var targetRowIndex = targetRow.rowIndex;
                var newdate = $find('<%=grdAvailability.ClientID%>').MasterTableView.get_columns()[targetCellIndex].get_uniqueName();
                var roomkey = $find('<%=grdAvailability.ClientID%>').MasterTableView.get_dataItems()[targetRowIndex].getDataKeyValue("RoomKey");
                var reservationkey = a.draggable.context.id.split('_')[1];
                var url = '../Reservation/Update/NewMoveReservation.aspx?RK=' + reservationkey + '&D=' + newdate + '&R=' + roomkey;

                ShowRadWindow('Move Reservation', url, 650, 650);
                //var oWnd = radopen('../Reservation/Update/NewMoveReservation.aspx?RK=' + reservationkey + '&D=' + newdate + '&R=' + roomkey, "winMove");

                //var oWnd = radopen('../Reservation/Test.aspx?RK=' + reservationkey + '&D=' + newdate + '&R=' + roomkey, "winMove");
            }

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 24 Apr 2014, 11:53 AM
Hello Myo,

The RadGrid control supports drag and drop of its DataItems. If you would like an example of the functionality, I would recommend taking a look at our RadGrid Items Drag-and-drop demo.

In case you need to have the ability to drag individual cells you could consider using a RadListView control. In order to achieve the needed functionality you could use an approach similar to the one illustrated in this demo.

Regards,
Viktor Tachev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Myo
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or