New to Telerik UI for ASP.NET MVC? Download free 30-day trial

GridSortSettingsBuilder

Methods

Enabled(System.Boolean)

Enables or disables sorting.

Parameters

value - System.Boolean

If set to true the user could sort the grid by clicking the column header cells. By default sorting is disabled.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Sortable(s => s.Enabled(true))
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

SortMode(Kendo.Mvc.UI.GridSortMode)

Sets the sort mode of the grid.

Parameters

value - GridSortMode

The sorting mode value.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Sortable(s => s.SortMode(GridSortMode.MultipleColumn))
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

AllowUnsort(System.Boolean)

Enables or disables unsorted mode.

Parameters

value - System.Boolean

If set to true the user can get the grid in unsorted state by clicking the sorted column header.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Sortable(s => s.AllowUnsort(false))
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

ShowIndexes(System.Boolean)

If set to true the user will see sort sequence indicators for sorted columns.

Parameters

value - System.Boolean

The value for ShowIndexes

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Sortable(s => s.ShowIndexes(true))
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

InitialDirection(System.ComponentModel.ListSortDirection)

Determines the inital (from un-sorted to sorted state) sort direction.

Parameters

initialDirection - System.ComponentModel.ListSortDirection

Determines the inital (from un-sorted to sorted state) sort direction. The supported values are asc and desc.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
                .Name("grid")
                .Columns(columns =>
                {
                    columns.Bound(p => p.OrderID).Filterable(false);
                    columns.Bound(p => p.Freight);  
                })
                .Sortable(s => s.InitialDirection(System.ComponentModel.ListSortDirection.Ascending))
                .Scrollable()
                .DataSource(dataSource => dataSource
                    .Ajax()
                    .PageSize(20)
                    .Read(read => read.Action("Orders_Read", "Grid"))
                )
            )

In this article
Not finding the help you need?