<kendo:grid-column-sortable>

If set to true the user can click the column header and sort the grid by the column field when sorting is enabled. If set to false sorting will be disabled for this column. By default all columns are sortable if sorting is enabled via the sortable option.

Example

<kendo:grid-column>
    <kendo:grid-column-sortable></kendo:grid-column-sortable>
</kendo:grid-column>

Configuration Attributes

allowUnsort boolean

If set to true the user can get the grid in unsorted state by clicking the sorted column header. If set to false the user will not be able to unsort the column once sorted.

Example

<kendo:grid-column-sortable allowUnsort="allowUnsort">
</kendo:grid-column-sortable>

compare java.lang.String

A JavaScript function which is used to compare the values. It has the same signature as the compare function accepted by Array.sort.The basic function implementation is as follows (pseudo-code): pseudo function compare(a, b, descending) { if (a is less than b by some ordering criterion) { return -1; }One notable exception is that we also supply a third parameter that indicates the sort direction (true for descending). See How-to: Stable Sort in Chrome for more details on how this can be useful.

Example

<kendo:grid-column-sortable compare="compare">
</kendo:grid-column-sortable>

initialDirection java.lang.String

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

Example

<kendo:grid-column-sortable initialDirection="initialDirection">
</kendo:grid-column-sortable>

Event Attributes

compare String

A JavaScript function which is used to compare the values. It has the same signature as the compare function accepted by Array.sort.The basic function implementation is as follows (pseudo-code): pseudo function compare(a, b, descending) { if (a is less than b by some ordering criterion) { return -1; }One notable exception is that we also supply a third parameter that indicates the sort direction (true for descending). See How-to: Stable Sort in Chrome for more details on how this can be useful.

Example

<kendo:grid-column-sortable compare="handle_compare">
</kendo:grid-column-sortable>
<script>
    function handle_compare(e) {
        // Code to handle the compare event.
    }
</script>

Event Tags

kendo:grid-column-sortable-compare

A JavaScript function which is used to compare the values. It has the same signature as the compare function accepted by Array.sort.The basic function implementation is as follows (pseudo-code): pseudo function compare(a, b, descending) { if (a is less than b by some ordering criterion) { return -1; }One notable exception is that we also supply a third parameter that indicates the sort direction (true for descending). See How-to: Stable Sort in Chrome for more details on how this can be useful.

Example

<kendo:grid-column-sortable>
    <kendo:grid-column-sortable-compare>
        <script>
            function(e) {
                // Code to handle the compare event.
            }
        </script>
    </kendo:grid-column-sortable-compare>
</kendo:grid-column-sortable>
In this article
Not finding the help you need?