0

I have a ListView with enabled column sorting. I want to make a reset button which will reset the column sorting and the ListView will look same as on page loading. Similar to reloading the entire page, but just reloading the ListView.

This Is my code:

 <button onclick="clearSorts()" style="float: right;" class="k-button" type="button" value="edit">Clear Sort</button>

$("#clearSorts()").click(function(e) {
     dataSource.sort({});
    });
user3378624
  • 5
  • 1
  • 7

3 Answers3

1

dataSource.sort({}) should remove all the sorting applied

OnaBai
  • 40,767
  • 6
  • 96
  • 125
knikolov
  • 1,650
  • 1
  • 12
  • 18
  • See [`filter`](http://docs.telerik.com/kendo-ui/api/framework/datasource#methods-filter) for more information – OnaBai Mar 04 '14 at 14:08
  • I have code like this: $("#clearSorts()").click(function(e) { dataSource.sort({}); }); Where is my error, because it does not work this way. – user3378624 Mar 05 '14 at 10:38
0

Just read the DataSource again

 var grid = $("#ProposalGrid").data("kendoGrid");
                    grid.dataSource.page(1); // or
                     grid.dataSource.read();
CSharper
  • 5,420
  • 6
  • 28
  • 54
0

I solved this error.

 function clearSorts(e) {
        var grid = $("#ProposalGrid").data("kendoGrid");
       // grid.dataSource.page(1); // or
        grid.dataSource.sort({});
Mark
  • 2,380
  • 11
  • 29
  • 49
user3378624
  • 5
  • 1
  • 7