This question is locked. New answers and comments are not allowed.
I have an MVC telerik grid:
Html.Telerik().Grid(Model)
.Name("UsersGrid")
.DataKeys(dataKeys => dataKeys.Add(p => p.UserID))
.DataBinding(dataBinding => dataBinding.Ajax().Select("AjaxBindingSSUsers", "Admin"))
.Columns(columns =>
{
//columns.Bound(u => u.IsActive).Filterable(false).ClientTemplate("<input type='checkbox' <#= IsActive? \"checked='checked'\" : \"\" #> style=' border: none;' />").Title("Active");
columns.Bound(u => u.UserID).Title("UserID").Encoded(false).Filterable(false);
columns.Bound(u => u.FirstName).Title("Name").Encoded(false).Filterable(false);
columns.Bound(u => u.Surname).Title("Surname").Encoded(false).Filterable(false);
columns.Bound(u => u.PartyID).Title("Party ID").Sortable(true).Filterable(false).Width(30);
columns.Bound(u => u.IsActive).ClientTemplate("<# if (IsActive==true) { #> <a href='#' onClick=\"deActivateAccount('<#= UserID #>')\">De-activate</a> <# } else { #> <a href='#' onClick=\"activateAccount('<#= UserID #>')\">Activate</a> <# } #>").Filterable(false);
columns.Bound(u => u.PartyID).Format("<a href='/Account/editUser/{0}'id='{0}'>Edit</a>").Encoded(false).Title(" ").Sortable(false).Filterable(false);
columns.Bound(u => u.UserID).Format("<a href='#'id='{0}' onClick=\"deleteUser('{0}')\">" + Resources.Resource.Device_Grid_Delete + "</a>").Encoded(false).Title(" ").Sortable(false).Filterable(false);
})
.Pageable(pager => pager.PageSize(20))
.Sortable()
.Filterable()
.HtmlAttributes(new { @class = "content_table" })
.Render();
and I search the UserID, FirstName and Surname columns with:
function searchUserList() {
var criteria = $("#UserSearchInput").val();
var grid = $("#UsersGrid").data("tGrid");
grid.filter("substringof(UserID,'" + criteria + "')~or~substringof(FirstName,'" + criteria + "')~or~substringof(Surname,'" + criteria + "')");
}
but for some reason the search does not give me results from the Surname columns. If I move the search to do UserID, then Surname and then FirstName - then the FirstName does not work... By "does not work" I mean that the result is filtered based on what I search for except that I picked up that it does not include the results from the 3rd (not working) column.
Any reason, are we limited to 2 columns or is my grid.filer not constructed correctly?
Thank you
Jack
Html.Telerik().Grid(Model)
.Name("UsersGrid")
.DataKeys(dataKeys => dataKeys.Add(p => p.UserID))
.DataBinding(dataBinding => dataBinding.Ajax().Select("AjaxBindingSSUsers", "Admin"))
.Columns(columns =>
{
//columns.Bound(u => u.IsActive).Filterable(false).ClientTemplate("<input type='checkbox' <#= IsActive? \"checked='checked'\" : \"\" #> style=' border: none;' />").Title("Active");
columns.Bound(u => u.UserID).Title("UserID").Encoded(false).Filterable(false);
columns.Bound(u => u.FirstName).Title("Name").Encoded(false).Filterable(false);
columns.Bound(u => u.Surname).Title("Surname").Encoded(false).Filterable(false);
columns.Bound(u => u.PartyID).Title("Party ID").Sortable(true).Filterable(false).Width(30);
columns.Bound(u => u.IsActive).ClientTemplate("<# if (IsActive==true) { #> <a href='#' onClick=\"deActivateAccount('<#= UserID #>')\">De-activate</a> <# } else { #> <a href='#' onClick=\"activateAccount('<#= UserID #>')\">Activate</a> <# } #>").Filterable(false);
columns.Bound(u => u.PartyID).Format("<a href='/Account/editUser/{0}'id='{0}'>Edit</a>").Encoded(false).Title(" ").Sortable(false).Filterable(false);
columns.Bound(u => u.UserID).Format("<a href='#'id='{0}' onClick=\"deleteUser('{0}')\">" + Resources.Resource.Device_Grid_Delete + "</a>").Encoded(false).Title(" ").Sortable(false).Filterable(false);
})
.Pageable(pager => pager.PageSize(20))
.Sortable()
.Filterable()
.HtmlAttributes(new { @class = "content_table" })
.Render();
and I search the UserID, FirstName and Surname columns with:
function searchUserList() {
var criteria = $("#UserSearchInput").val();
var grid = $("#UsersGrid").data("tGrid");
grid.filter("substringof(UserID,'" + criteria + "')~or~substringof(FirstName,'" + criteria + "')~or~substringof(Surname,'" + criteria + "')");
}
but for some reason the search does not give me results from the Surname columns. If I move the search to do UserID, then Surname and then FirstName - then the FirstName does not work... By "does not work" I mean that the result is filtered based on what I search for except that I picked up that it does not include the results from the 3rd (not working) column.
Any reason, are we limited to 2 columns or is my grid.filer not constructed correctly?
Thank you
Jack