1
votes

I have a kendo grid with column with 'sortable' set to true. I want to determine in the dataBound function if it was called as a result of the sort arrow being clicked on. How do I do this?

1

1 Answers

1
votes

To see if it was triggered by the arrow being clicked you could see if the direction of the sort changed. To get the direction of the sort you can do something like this:

$('#yourGrid').data('kendoGrid').dataSource.bind('change', function() {

      //YOUR CODE

      var grid = $("#yourGrid").data("kendoGrid");
      var dataSource = grid.dataSource;
      var sortArray = ds.sort();

      //assuming you only have column being sorted you would use the array in the position 0
      var direction = sortArray[0].dir;

      //YOUR CODE

    }