Reputation: 1642
I have to customize the kendo grid filter event. On applying filter instead of filtering the records based on the available records on the grid i need to requery along with filters.
i.e:
Onfilter
{
prevent filtering on existing data()
requery from db and apply filter on that data()
}
so i have coded like below.(in document ready)
(document).ready(function (){
grid.bind("filter", function (e) {
if ((e.filter == null) ) {
mymanualretrieve();
}
if (e.filter!=null) {
tempFilter = e.filter.filters;
}
//i don't want the default filtering. to prevent that i am clearing it out
e.filter = grid.dataSource.filter({});}
I have one dropdown where i should call retrieve again with the filters applied.so i am trying like below in change event of drop down.
if (tempFilter != null && tempFilter != undefined) {
grid.dataSource.filter({ tempFilter });
mymanualretrieve();
tempFilter = grid.dataSource.filter().filters;
//I need to prevent default filtering here as well, but on applying the below code, my manual retrieve is not queried based on filters
grid.dataSource.filter({});
After this changes dcument.ready also doesn't get hit on filtering
Upvotes: 1
Views: 407
Reputation: 1761
custom filter options for every column: asp.net MVC
columns.Bound(c => c.columnName).Format("{0}%").Filterable(
ftb=>ftb.Cell(cell=>cell.ShowOperators(true))
.Extra(false)
.Operators(op=>op.ForNumber(fn=>fn.Clear()
.IsEqualTo(CommonResource.GridFilter_IsEqualTo)
)))
.Title("Column Name");
Upvotes: 1