Grid filter button

2 posts, 0 answers
  1. Craig Mellon
    Craig Mellon avatar
    53 posts
    Member since:
    May 2005

    Posted 14 Dec 2010 Link to this post

    Hi,

    I have added some javascript to the filter button that appears at the side of the text box on RAD Grid filter to basically clear the filter when the user clicks it rather than bring a menu down etc.  Heres the code I used:

    <ClientSettings>
         <ClientEvents OnFilterMenuShowing="filterMenuShowing" />
    </ClientSettings>

    function
    filterMenuShowing(sender, args) {
        var filterRow = args.get_tableView().get_tableFilterRow();
        var columnName = args.get_column().get_uniqueName();
        var cell = args.get_tableView()._getCellByColumnUniqueNameFromTableRowElement(filterRow, columnName);
        var filterValue = $telerik.findElement(cell, "FilterTextBox_" + columnName).value;
          
        args.set_cancel(true);
        args.get_tableView().filter(columnName, "", "NoFilter");
    }


    This works perfect first time round, I can enter a letter then filter the grid, then click the button and it clears the textbox and refreshes the grid to it's non filtered state. The problem is it just works the once, once I have click the button the filter clears when I type another a letter and hit return to filter the grid again it dosen't filter to my original setting of "StartsWith".

    Thank you.

  2. Craig Mellon
    Craig Mellon avatar
    53 posts
    Member since:
    May 2005

    Posted 14 Dec 2010 Link to this post

    I fixed this using the following code in the PreRender event..

    RadGrid1.Columns.FindByUniqueName("Region").CurrentFilterFunction = GridKnownFunction.StartsWith
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top