Configuring Default filter options

1 Answer 20 Views
Filter Grid
Maria
Top achievements
Rank 1
Maria asked on 21 Mar 2022, 02:05 PM

In Kendogrid how do we change the default filter options from "is true" and "is  false" to "Yes" and "No"  to match the data in the columns 

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 24 Mar 2022, 07:47 AM

Hello Maria,

You can use the following columns.filterable.ui logic to override the radio buttons and change their labels

              { field: "Discontinued",
               width: "130px", 
               filterable: {
                 ui: function(element) {
                   $("div.k-filter-menu-container").find(".k-filter-help-text").after('<label><input type="radio" data-bind="checked: filters[0].value" value="true" name="filters[0].value">Yes</label><label><input type="radio" data-bind="checked: filters[0].value" value="false" name="filters[0].value">No</label>');
                   $(element).closest("span.k-textbox").remove();
                 }
               } 
              }

Here is a runnable Dojo I prepared demonstrating the above: https://dojo.telerik.com/afuSODum

Let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Filter Grid
Asked by
Maria
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or