This question is locked. New answers and comments are not allowed.
On my page right now i am allowing a user to filter the search data. I do this by having 2 textboxes above the grid. When the user enters data and presses apply i then combine the request through javascript.
Now comes the funny part.
I allow filtering on the telerik object. No icons are shown above the column names (perfect). I can now filter with my textboxes without having the icons in my columns.
Now if i implement sorting on specific columns, the icons appear!?
So how can i allow sorting of columns without showing the icons. I still want to do filtering with my textboxes.
Javascript (works):
So to sum it up.
- No icons should be shown besides the column name.
- 2 of the 4 columns should be sortable.
- It should be filterable from the textboxes above the grid.
Now comes the funny part.
I allow filtering on the telerik object. No icons are shown above the column names (perfect). I can now filter with my textboxes without having the icons in my columns.
Now if i implement sorting on specific columns, the icons appear!?
So how can i allow sorting of columns without showing the icons. I still want to do filtering with my textboxes.
@(Html.Telerik() .Grid(Model.Model) .Name("CommunityUsersGrid") .Columns(columns => { columns.Bound(dlm => dlm.Firstname).Sortable(true).Title("Firstname"); columns.Bound(dlm => dlm.Surname).Sortable(true).Title("Surname"); columns.Bound(dlm => dlm.NumberOfPosts).Sortable(false).Title("Number of posts"); columns.Bound(dlm => dlm.CanPost).Sortable(false).Title("Can user post?"); }) .DataBinding(dataBinding => dataBinding.Ajax().Select(new RouteValueDictionary { { "eventName", Model.EventShortName }, { "Action", "_GetUserList" }, { "Controller", "Ajax" }, { "Area", "Community" } })) .EnableCustomBinding(true) .Filterable(x => { x.Enabled(true); if (!string.IsNullOrEmpty(Model.SearchString1)) x.Filters(c => c.Add(v => v.Firstname).Contains(Model.SearchString1)); if (!string.IsNullOrEmpty(Model.SearchString2)) x.Filters(c => c.Add(v => v.Surname).Contains(Model.SearchString2)); }) .Sortable(x => { x.SortMode(GridSortMode.SingleColumn); }) .Pageable(paging => paging.PageSize(10)) .DataKeys(dk => dk.Add(key => key.Id)))Javascript (works):
function CommunityUsersGrid_applyFilter() { // Get a copy of the telerik grid var grid = getGrid('CommunityUsersGrid'); if (grid == null) return; // Get the search fields var firstname = $("#firstname").val(); var surname = $("#surname").val(); // Check what fields that we need to apply searching on and add them to the filters in the grid if (firstname != "" && surname != "") grid.filter("substringof(Firstname,'" + firstname + "')~and~substringof(Surname,'" + surname + "')"); else if (firstname != "") grid.filter("substringof(Firstname,'" + firstname + "')"); else if (surname != "") grid.filter("substringof(Surname,'" + surname + "')"); else grid.filter();}So to sum it up.
- No icons should be shown besides the column name.
- 2 of the 4 columns should be sortable.
- It should be filterable from the textboxes above the grid.
