Grid Drag and Drop

2 Answers 213 Views
Grid
Joshua
Top achievements
Rank 1
Iron
Joshua asked on 19 Jul 2022, 07:25 PM

I'm trying to add drag and drop functionality on my Grid. I have followed the documentation here, https://demos.telerik.com/aspnet-mvc/grid/drag-drop. However, I'm getting an gridreorderingsettingsbuilder does not contain a definition for 'Rows'. I'm also getting another error on .Draggable.  I'm using version 2021.1.224.545. Do I need to update my version? 

            @(Html.Kendo().Grid<AHPD.Data.Model.Questions>()
                .Name("grdSubs")
                .Columns(columns =>
                {
                    columns.Template(@<text> </text>).Draggable(true);
                    columns.Bound(p => p.Disabled).ClientTemplate("<div style='text-align: center;'>" +
                                                                        "# if(Disabled == '0'){ #" +
                                                                        "<div><input type='checkbox' disabled style='opacity: 1;' ><label></label></div>" +
                                                                        "# } else { #" +
                                                                        "<div><input type='checkbox' disabled checked style='opacity: 1;' ><label></label></div>" +
                                                                        "# } #" +
                                                                        "</div>").Title("Off").Width(80);
                    columns.Bound(p => p.Question).Title("Question");
                    columns.Bound(p => p.QuestionId).Title("Edit").Width(80).ClientTemplate("<div style='text-align: center;'onclick=\"edit(event)\"><img src='" + Url.Content("~/Content/aert/images/edit.png") + "' style='width: 20px; height: 20px;' /></div>");
                    columns.Bound(p => p.Status).Title("Status").Width(150);
                })
                    .Sortable()
                    .Pageable()
                    .ClientDetailTemplateId("subs")
                    .Navigatable()
                    .Reorderable(reorder => reorder.Rows(true))
                    //.HtmlAttributes(new { style = "min-height:600px;" })
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .PageSize(50)
                        .Read(read => read.Action("GetQuestionsList", "Owner"))
                        .Model(model =>
                        {
                            model.Id(p => p.QuestionId);
                            model.Field(p => p.Question).Editable(false);
                            model.Field(p => p.Status).Editable(false);
                        })
                    )
                    .Events(events => events.DataBound("dataBound"))
            )


2 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 22 Jul 2022, 05:55 PM

Hello Joshua,

 

Thank you for writing to us.

This version you mentioned is pretty new and should contain all the necessary dragging logic implemented in the source code.

One thing I couldn't see in the snippet is this line:

 ev.RowReorder("onRowReorder");
Can you run the local demos which are installed with your Telerik MVC UI and then check the Grid dragging demo whether it is working as expected? The .sln file for the project should be located in a path similar to this one:

D:\Program Files (x86)\Progress\Telerik UI for ASP.NET MVC R1 2021\wrappers\aspnetmvc\Examples\MVC5

Feel free to run this and let me know about the result.

 

Regards,
Eyup
Progress Telerik

The Premier Dev Conference is back! 

Coming to you live from Progress360 in-person or on your own time, DevReach for all. Register Today.


0
Joshua
Top achievements
Rank 1
Iron
answered on 27 Jul 2022, 02:20 PM

Thanks Eyup, 

Just wanted to let you know updating the .dll and all the .js files resolved the issue. 

Eyup
Telerik team
commented on 01 Aug 2022, 10:19 AM

I am happy to hear that!

And thank you for sharing the solution with our community.

Tags
Grid
Asked by
Joshua
Top achievements
Rank 1
Iron
Answers by
Eyup
Telerik team
Joshua
Top achievements
Rank 1
Iron
Share this question
or