Question

I am using Telerik's controls for ASP.Net AJAX version Q2 , 2011.

I have a RadGrid that is being databound on client side to a web service. Everything is working fine, except that when I try to clear sorting using following javascript, the sorting clears up but the asc/desc image still shows up next to the column header.

Is there a way to also not show the asc/desc image when sorting gets cleared by calling the function below?

           function RemoveSorting() {
             tableView.get_sortExpressions().clear();
             tableView.rebind();
        }
Was it helpful?

Solution

This is what I used, which appears to be working without issues. Just added 2 jQuery lines to the JavaScript function. These lines set the css display attribute to none for all elements that have SortAsc or SortDesc in their id.

function RemoveSorting() {

    var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

   //clear sorting on all data columns ( but not the asc/desc images)
   tableView.get_sortExpressions().clear();

   //make all asc images invisible
   $("[id*=SortAsc]").each(function (index) { $(this).css('display', 'none'); });

   //make all desc images invisible
   $("[id*=SortDesc]").each(function (index) { $(this).css('display', 'none'); });

   tableView.rebind();
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top