This question is locked. New answers and comments are not allowed.

Alexandre Jobin
Top achievements
Rank 1
Alexandre Jobin
asked on 14 Jun 2010, 09:20 PM
hi! is it possible to add a button to clear all the filters? i wanted to add one in the footer toolbar
thanks!
thanks!
6 Answers, 1 is accepted
0
Accepted
Hello Alexandre Jobin,
Yes it is possible. Here is how to achieve it:
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Yes it is possible. Here is how to achieve it:
<%= Html.Telerik().Grid(Model)
.Name("Grid")
.ToolBar(toolbar => toolbar.Custom().Text("Clear Filters").HtmlAttributes(new {onclick="clearFilters(event)"}))
.DataBinding(dataBinding => dataBinding.Ajax().Select("_Filtering", "Grid"))
.Pageable()
.Sortable()
.Filterable(filtering => filtering
.Filters(filters => filters
.Add(o => o.Customer.ContactName).StartsWith((string)ViewData["startsWith"])
))
%>
<script type="text/javascript">
function clearFilters(e) {
e = new $.Event(e);
e.preventDefault();
var grid = $('#Grid').data('tGrid');
grid.filter('');
}
</script>
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

Alexandre Jobin
Top achievements
Rank 1
answered on 15 Jun 2010, 02:22 PM
how can i put it on the bottom toolbar?... maybe as an icon?
alex
alex
0
Hi Alexandre Jobin,
Currently you cannot add content to the grid footer.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Currently you cannot add content to the grid footer.
Regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0

Diiimo
Top achievements
Rank 1
answered on 28 Oct 2010, 08:32 PM
Hi Atanas,
how can i reset the filter dialogs and the icons on the columns?
Regards,
Timo
0

SEAN
Top achievements
Rank 1
answered on 25 Nov 2011, 09:22 PM
I found that code given here did result in all the data being shown without filtering, but the filters were still set in the UI, so I added a couple of things to clean them up too:
function clearFilters(e) {
e = new $.Event(e);
e.preventDefault();
//First clear the filter dialogs - took this from clearClick in telerik.grid.filtering.js
$('div.t-filter-options')
.find('input')
.removeAttr('checked')
.removeClass('t-state-error')
.not(':radio')
.val('')
.end()
.end()
.find('select')
.removeClass('t-state-error')
.find('option:first')
.attr('selected', 'selected');
//Now iterate through the columns and clear the filters - this will cause the filter method to reset the filter icons
var grid = $('#Grid').data('tGrid');
$.each(grid.columns, function (index, value) {
if (this.filters != null) this.filters = null;
});
//Now the filter method will do the rest
grid.filter('');
}
0

Dan
Top achievements
Rank 1
answered on 22 May 2012, 03:43 PM
Thank you Sean! This was useful.
Dan
Dan