0

I have a kendo ui grid on my page. And I have a button too. I want when I click button, sortable property on a specify column disable, and when click the button again, sortable property enable.

How to I do this? Thanks.

Tavousi
  • 14,848
  • 18
  • 51
  • 70

3 Answers3

1

Runtime enabling/disabling the sorting feature of the Grid is not supported. But you can find some approaches to achieve it here: http://www.telerik.com/forums/disable-or-remove-sortable-capability-on-column-with-rebuilding-entire-grid

Hope this link will help you.

Eru Iluvatar
  • 101
  • 3
0

There is no method for this - this is option which is set only upon initialziation. So you will need to re-initialize the whole Grid. Covered here.

The column.sortable option should be set to true/false depending on the button that was clicked.

Community
  • 1
  • 1
Petur Subev
  • 19,983
  • 3
  • 52
  • 68
0

You need to write an click event for a table header on javascript.This event will prevent click on table header.

 $(".k-grid-header .k-link").click(function (e) {
        e.preventDefault();
        if ($(this).text() === Header Name) {
            e.stopPropagation();
        }
    });

e.PreventDefault helps to avoid window jump to top when clicking #-links. Give your headername into the if condition to which you want to disable sorting

Deepak Kv
  • 61
  • 9