In a grid, is there a way of setting an initial filter when the grid loads so that when the end user is clicks on the filter button, they will see the contents of the initial filter (for example "Hanari Carnes" - see step1...png), and can clear the filter to display all of the data (step2...png)?
8 Answers, 1 is accepted
The default behavior is to show the initial filters within the Grid's filter menu. Please, take a look at this short video which captures the behavior, maybe I'm missing something obvious.
Regards,Rosen
the Telerik team


Adding .Filter(f => f.Add(p => p.WBS).StartsWith("BR549")) does indeed apply that filter to the grid right from the start.
But after a user clears that programmed initial filter, it seems to corrupt the operation of the filters from then on. "Clear" filter removes it from the filter menu, but does not update the result set. Changing the filter may or may not update the result set. Is this a known bug and is there a recommended fix?
Hello Darron,
I'm not able to observe such behavior locally. Please provide a sample project which to demonstrates the issue in question.
Regards,Rosen
Telerik by Progress

The problem was due to the size of the dataset, too many lines returned to the grid.
If paging is turned off, and too many lines are requested, the grid will show as if empty.
If an initial filter reduces the set to a size the grid can show without paging, then changing the filter to include additional lines can cause it to exceed the limit, which causes the filter to show changed, but the results to stay with the results of the previous filter.
The problem is due to the grid's size limitations, and solvable using paging, which I wanted to avoid.
But paging is probably the quickest way to avoid the potential for failure due to volume.
On another note, I wanted to use the "Columns Menu" but noticed that its use hides the filter icon's highlighting that should show when a filter has been applied.
Is there an easy way to add an "As Filtered" description to the footer?
Hello Darron,
The paging behavior you have described is most probably due to the response hitting the JavaScriptSerializer max response length limit. This is discussed here.
I'm not sure what you mean by "As Filtered". However, if you want to show inside the footer template information if the current column is filtered. You could do this using similar to the following JavaScript functions:
function
hasFilter(fieldName) {
var
filter = $(
"#grid"
).getKendoGrid().dataSource.filter();
if
(filter) {
filter = filter.filters || [filter];
var
matcher =
function
(filter) {
if
(filter.filters) {
return
$.grep(filter.filters, matcher).length > 0;
}
return
filter.field === fieldName;
};
return
$.grep(filter, matcher).length > 0;
}
return
false
;
}
function
footerTemplate(columnName) {
return
function
() {
return
hasFilter(columnName) ?
"filtered"
:
""
;
}
}
Which can be used in the column definition such as -> footerTemplate: footerTemplate("ShipCity") // where the ShipCity is the data field.
Also if you continue to experience difficulties I would suggest to open a separate support request as the topic diverge from the original thread's discussion. Regards,
Rosen
Telerik by Progress

thanks for the video - after hours of searching of this functionallity - finally.
but here a furtheron question on this.
how to do AND - OR conditions in this way?
thanks
Hello Alain,
The filter.logic contains the logic whether filter values should be evaluated as "AND" or "OR".
Regards,Boyan Dimitrov
Telerik by Progress