jdag jdag - 1 year ago 270
Javascript Question

how to clear filtering, sorting and paging on a webdatagrid on client side?

I have a webdatagrid which retains data on searching in text box. I have noticed when I filter/page/sort the data and before clearing any of these I make a new search then the new search results retains previous filter/page/sort condition. I am not clearing it before reloading the page. I have search method on client side and I am using following code which does not work:

function btnSearch_click(sender, evntArgs){
var grid = $find('<%= grid1.ClientID %>');

This code is incorrect.

Answer Source

since my grid loads on hitting search button. I used following on server side:

if (search == "True")
                  var filtering = grid1.Behaviors.Filtering;
                  this.grid1.Behaviors.Paging.PageIndex = 0;
                  filtering.FilterType = Infragistics.Web.UI.GridControls.FilteringType.RowFilter;
                  filtering.FilterType = Infragistics.Web.UI.GridControls.FilteringType.ExcelStyleFilter;


I wanted to implement excel style filter and infragistics had no way to reproduce excel filter after clearing it I had to apply row type filter first and then change the filter type to excel type.