How can I hide the filter icon?

2 Answers 261 Views
Filter Grid
Todd
Top achievements
Rank 1
Todd asked on 20 May 2022, 01:40 PM | edited on 20 May 2022, 02:35 PM

I have a RadGridView with IsFilteringAllowed="True" and CanUserSortColumns="True" properties.  This give my column headers sort and filter functions, and shows the filter icon on each. The columns are defined as GridViewDataColumns.  

I am trying to find a way to remove, or at least hide, the filter icon from just one of my column headers.  Is there a way to do that?

Here is the relevant code:

<telerik:RadGridView Grid.Row="0" ItemsSource="{Binding StationState.DewaxStatuses}"
                                     Style="{StaticResource RadGridViewDefault}"
                                     IsFilteringAllowed="True" CanUserSortColumns="True"

<telerik:GridViewDataColumn DataMemberBinding="{Binding WorkItemsCount}" Header="Molds" 
                                                    Style="{StaticResource GridViewFooterDataColumn}" 
                                                    TextAlignment="Right" ShowFilterButton="False">

I have tried moving the IsFilteringAllowed property into the individual data columns but it isn't valid in those.  I also tried adding FilterMemberPath to the one column, which left the icon visible and the dropdown available but removed the data from the menu.  That is, you could view the menu but there is nothing to select.

I also looked at ShowFilterButton, but that only removes the button inside the menu, not the icon.

I hope this is enough information, but I can supply more if needed.

Thanks,

Todd

Todd
Top achievements
Rank 1
commented on 20 May 2022, 01:43 PM

To clarify, I have multiple GridViewDataColumns in my grid, and want to remove the filter icon from just one and leave the rest visible and usable.

2 Answers, 1 is accepted

Sort by
0
Accepted
Alan
Top achievements
Rank 2
Iron
Iron
answered on 20 May 2022, 10:05 PM | edited on 20 May 2022, 10:06 PM
Looks like you're setting the filter on for all columns on the column header row?
Todd
Top achievements
Rank 1
commented on 23 May 2022, 09:18 PM

Thanks for the input.  I did originally intend to set all columns to have filtering and sorting enabled, then wanted to remove the filter from the one header.  After some research I discovered IsFilterable="False" which I added to the GridViewDataColumn definition.  That removed the icon for me.
0
Alan
Top achievements
Rank 2
Iron
Iron
answered on 20 May 2022, 10:18 PM

I took this approach:

@(Html.Kendo().Grid<Address>()
          .Name("AddressGrid")
          .Height(500)
          .Width(1800)
          .Selectable(s => s.Enabled(true))
          .Pageable(p => p.AlwaysVisible(true)
          .Navigatable(true)
          .PageSizes(new int[] {15, 25, 35, 50})
          .Position(GridPagerPosition.Bottom)
          .PreviousNext(true)
          .Refresh(true))
          .Navigatable(true)
          .ToolBar(t => t.Custom().Text("Add Address")
                                                    .IconClass("k-icon k-i-add")
                                                    .HtmlAttributes(new { script = "AddScript" }))
          .ToolBar(t => t.Save().SaveText("Update Address"))
          .ToolBar(t => t.Search())
          .Scrollable(s => s.Virtual(true)
                                       .Endless(true))
          .Columns(columns => { columns.Bound(a => a.id).Editable("false")
                                                        .Filterable(false)
                                                        .Draggable(false)
                                                        .Visible(false);
                                columns.Bound(a => a.attention).Title("Attention of:")
                                                               .Editable("true")
                                                               .Filterable(true)
                                                               .Draggable(false)
                                                               .Width(43);
                                columns.Bound(a => a.invoiceTo).Title("Invoice To:")
                                                               .Editable("true")
                                                               .Filterable(true)
                                                               .Draggable(false)
                                                               .Width(43);
                                columns.Bound(a => a.addressTypes).Title("Address Types")
                                                                  .Editable("true")
                                                                  .Draggable(false)
                                                                  .Filterable(true)
                                                                  .Width(60);
                                columns.Bound(a => a.streetLine1).Title("Address Line 1")
                                                                 .Editable("true")
                                                                 .Sortable(true)
                                                                 .Draggable(false)
                                                                 .Filterable(false)
                                                                 .Width(70);
                                columns.Bound(a => a.streetLine2).Title("Address Line 2")
                                                                 .Editable("true")
                                                                 .Sortable(true)
                                                                 .Draggable(false)
                                                                 .Filterable(false)
                                                                 .Width(70);
                                columns.Bound(a => a.city).Title("City")
                                                          .Editable("true")
                                                          .Sortable(true)
                                                          .Draggable(false)
                                                          .Filterable(true)
                                                          .Width(45);
                                columns.Bound(a => a.stateProvince).Title("State/Province")
                                                                   .Editable("true")
                                                                   .Sortable(true)
                                                                   .Draggable(false)
                                                                   .Filterable(true)
                                                                   .Width(50);
                                columns.Bound(a => a.CountryCode).Title("Country")
                                                                 .Editable("true")
                                                                 .Sortable(true)
                                                                 .Draggable(false)
                                                                 .Filterable(true)
                                                                 .Width(35);
                                columns.Bound(a => a.postalCode).Title("Postal Code")
                                                                .Editable("true")
                                                                .Sortable(true)
                                                                .Draggable(false)
                                                                .Filterable(true)
                                                                .Width(45);
                                columns.Command(command => { command.Edit(); 
                                                                                            command.Destroy(); }).Title("C.R.U.D. Operations")
                                                                                                                                   .Width(60)
                                                                                                                                   .Draggable(false); })
          .Events(events => events.Change("onChange"))
          .Filterable(f => f.Enabled(true))
          .Sortable(s => s.Enabled(true))
          .Selectable(sel => sel.Mode(GridSelectionMode.Single))
          .Editable(e => e.Enabled(true))
          .Editable(editable => editable.Mode(GridEditMode.PopUp).Window(w => w.Title("Edit/Update").Width(500)))
          .DataSource(dataSource => dataSource.Ajax().Model(model => model.Id(p => p.id)).PageSize(35)
                                                     .Events(events => events.Error("error_handler")).ServerOperation(false)  
                                                     @*.Read(read => read.Url("/Address/GetAddress").Type(HttpVerbs.Get))*@
                                                     .Update(update => update.Action("UpdateAddress", "Address").Type(HttpVerbs.Put))
                                                     .Create(create => create.Action("CreateAddress", "Address"))
                                                     .Destroy(delete => delete.Action("DeleteAddress", "Address"))) )

Tags
Filter Grid
Asked by
Todd
Top achievements
Rank 1
Answers by
Alan
Top achievements
Rank 2
Iron
Iron
Share this question
or