This is a migrated thread and some comments may be shown as answers.

Grid filter button

1 Answer 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Craig Mellon
Top achievements
Rank 1
Craig Mellon asked on 14 Dec 2010, 11:50 AM
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.

1 Answer, 1 is accepted

Sort by
0
Craig Mellon
Top achievements
Rank 1
answered on 14 Dec 2010, 03:54 PM

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

RadGrid1.Columns.FindByUniqueName("Region").CurrentFilterFunction = GridKnownFunction.StartsWith
Tags
Grid
Asked by
Craig Mellon
Top achievements
Rank 1
Answers by
Craig Mellon
Top achievements
Rank 1
Share this question
or