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

Defines the fluent interface for configuring the Sortable.

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Type Parameters:

TModel

Syntax:

C#
public class GridSortSettingsBuilder<TModel> where TModel : class

Inheritance: objectGridSortSettingsBuilder<TModel>

Inherited Members object.GetType()object.MemberwiseClone()object.ToString()object.Equals(object)object.Equals(object, object)object.ReferenceEquals(object, object)object.GetHashCode()...

Constructors

Initializes a new instance of the GridSortSettingsBuilder<TModel> class.

C#
public GridSortSettingsBuilder(GridSortableSettings settings)
Parameters:settingsGridSortableSettings

The settings.

Methods

Enables or disables unsorted mode.

C#
public virtual GridSortSettingsBuilder<TModel> AllowUnsort(bool value)
Parameters:valuebool

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

Returns:

GridSortSettingsBuilder<TModel>

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

Enables or disables sorting.

C#
public virtual GridSortSettingsBuilder<TModel> Enabled(bool value)
Parameters:valuebool

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

Returns:

GridSortSettingsBuilder<TModel>

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

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

C#
public GridSortSettingsBuilder<TModel> InitialDirection(ListSortDirection initialDirection)
Parameters:initialDirectionListSortDirection

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

Returns:

GridSortSettingsBuilder<TModel>

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

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

C#
public GridSortSettingsBuilder<TModel> ShowIndexes(bool value)
Parameters:valuebool

The value for ShowIndexes

Returns:

GridSortSettingsBuilder<TModel>

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

Sets the sort mode of the grid.

C#
public virtual GridSortSettingsBuilder<TModel> SortMode(GridSortMode value)
Parameters:valueGridSortMode

The sorting mode value.

Returns:

GridSortSettingsBuilder<TModel>

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