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

Defines the fluent interface for configuring bound columns sortable options

Definition

Namespace:Kendo.Mvc.UI.Fluent

Assembly:Kendo.Mvc.dll

Syntax:

C#
public class GridBoundColumnSortableBuilder

Inheritance: objectGridBoundColumnSortableBuilder

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 GridBoundColumnSortableBuilder class.

C#
public GridBoundColumnSortableBuilder(GridBoundColumnSortableSettings settings)
Parameters:settingsGridBoundColumnSortableSettings

The settings.

Methods

Sets a value determining whether the column can be unsorted or not.

C#
public GridBoundColumnSortableBuilder AllowUnsort(bool allowUnsort)
Parameters:allowUnsortbool

The a value determining whether the column can be unsorted (true) or not (false).

Returns:

GridBoundColumnSortableBuilder

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
columns.Bound(o => o.OrderDate)
.Sortable(sortable =>
sortable.AllowUnsort(false)
)
))

Sets a JavaScript function which is used to compare the values.

C#
public GridBoundColumnSortableBuilder Compare(Func<object, object> handler)
Parameters:handlerFunc<object, object>

The handler.

Returns:

GridBoundColumnSortableBuilder

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt;
columns.Bound(o =&gt; o.OrderDate)
.Sortable(sortable =&gt;
sortable.Compare(
@&lt;text&gt;
function(a, b, descending) {
// compare logic
}
&lt;/text&gt;
)
)
))

Sets a JavaScript function which is used to compare the values.

C#
public GridBoundColumnSortableBuilder Compare(string handler)
Parameters:handlerstring

The JavaScript handler.

Returns:

GridBoundColumnSortableBuilder

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt;
columns.Bound(o =&gt; o.OrderDate)
.Sortable(sortable =&gt;
sortable.Compare("compare")
)
))

Determines the initial sort direction.

C#
public GridBoundColumnSortableBuilder InitialDirection(ListSortDirection initialDirection)
Parameters:initialDirectionListSortDirection

The initial sort direction.

Returns:

GridBoundColumnSortableBuilder

Example:
C#
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =&gt;
columns.Bound(o =&gt; o.OrderDate)
.Sortable(sortable =&gt;
sortable.InitialDirection(ListSortDirection.Ascending)
)
))