This question is locked. New answers and comments are not allowed.
Hi,
I'm using telerik MVC grid filtering in client operation mode. I'm filtering grid based on textbox value entered.
searchGridItems is the textBox used and function Reset is calling on textBoxKeyPress.
I'm facing the following errors on implementation
1) Filtering working in And logic only. Can't able to work with Or logic
2) When clicking on pagination, filtering lost and grid showing all items
Please see the below code and help me ASAP
function Reset() {
var _searchTerm = $("#searchGridItems").val();
var grid = $('#Grid').data("tGrid");
filterGrid(grid, _searchTerm, SelectedTab);
}
function filterGrid(grid, searchTerm, tabIndex) {
var filterExpr = new Array();
$.each(grid.columns, function (index, column) {
if (column.type == "String") {
filterExpr.push({ field: column.member, operator: "substringof", value: searchTerm, logic: "or" });
}
});
if (filterExpr != "") {
grid.dataSource.filter(filterExpr);
}
}
I'm using telerik MVC grid filtering in client operation mode. I'm filtering grid based on textbox value entered.
searchGridItems is the textBox used and function Reset is calling on textBoxKeyPress.
I'm facing the following errors on implementation
1) Filtering working in And logic only. Can't able to work with Or logic
2) When clicking on pagination, filtering lost and grid showing all items
Please see the below code and help me ASAP
function Reset() {
var _searchTerm = $("#searchGridItems").val();
var grid = $('#Grid').data("tGrid");
filterGrid(grid, _searchTerm, SelectedTab);
}
function filterGrid(grid, searchTerm, tabIndex) {
var filterExpr = new Array();
$.each(grid.columns, function (index, column) {
if (column.type == "String") {
filterExpr.push({ field: column.member, operator: "substringof", value: searchTerm, logic: "or" });
}
});
if (filterExpr != "") {
grid.dataSource.filter(filterExpr);
}
}