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

Reorder Rows

2 Answers 406 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 1
Jason asked on 04 Dec 2016, 02:51 PM

Is there an option to allow a user to reorder grid rows using the Grid for ASP.NET Core?

Preferably I would like to allow rows to be reordered by drag and drop and by using up/down arrows in a toolbar. 

2 Answers, 1 is accepted

Sort by
0
Jason
Top achievements
Rank 1
answered on 05 Dec 2016, 12:08 AM

I was not able to get this working in Chrome (Version 55.0.2883.75 m (64-bit))

I was able to get this working in Edge by following the information on Sortable integration with Grid here:

http://demos.telerik.com/aspnet-core/sortable/integration-grid

However, even in Edge there is an issue with the grid cells being editable and sortable.  I can edit text values in the cell, but I am not able to use the mouse to select text in the cell or to change cursor position in the cell.

0
Konstantin Dikov
Telerik team
answered on 07 Dec 2016, 02:53 PM
Hi Jason,

If you want to use Batch editing you need to define a template column with some element that will be set as "Handler" for the sortable widget:
columns.Template(@<text></text>).ClientTemplate("<span class='dragIcon'>↕</span>");

The sortable configuration:
@(Html.Kendo().Sortable()
    .For("#Grid")
    .Filter("table > tbody > tr")
    .Cursor("move")
    .Handler(".dragIcon")
    .HintHandler("noHint")
    .PlaceholderHandler("placeholder")
    .ContainerSelector("#Grid tbody")
    .Events(events => events.Change("onChange"))
)
<style>
    .dragIcon {
        cursor: move;
    }
</style>

You can further customize the element in the template column in order to get the desired appearance.

Hope this helps.


Regards,
Konstantin Dikov
Telerik by Progress
Telerik UI for ASP.NET Core is ready for Visual Studio 2017 RC! Learn more.
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Answers by
Jason
Top achievements
Rank 1
Konstantin Dikov
Telerik team
Share this question
or