This is a migrated thread and some comments may be shown as answers.

[Solved] Custom Filter Option

4 Answers 176 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bob Kimbrough
Top achievements
Rank 1
Bob Kimbrough asked on 23 Apr 2010, 05:35 PM
I would like to restrict available select options for the Filter dialog. 

I understand that I can modify the js file that builds the options.  However, I would like to be able to change the options on a
field-by-field basis.  Is this possible?

-Bob

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 Apr 2010, 07:51 AM
Hello Bob Kimbrough,

No, this is not possible. We are always showing a preset of filtering options. You can modify the telerik.grid.filtering.js file in order to achieve what you want.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Mike
Top achievements
Rank 1
answered on 08 Nov 2011, 01:02 AM
Hello Atanas Korchev,

Is this featue still unavailable for MVC 3 Q2 2011 Grid?
If it is not available, could you please let me know how to remove the "EndsWith" select option?

Best Regards
--Mike Sagalovich
0
Atanas Korchev
Telerik team
answered on 08 Nov 2011, 11:50 AM
Hello Mike,

 Yes, this feature is not available in this release. I have attached a sample project which shows how to implement this now. 

Here is the important code:

<%= Html.Telerik().Grid<TelerikMvcApplication57.Models.Product>()
         .Name("Grid")
         .Columns(columns =>
         {
         columns.Bound(p => p.ID).Width(100);
         columns.Bound(p => p.Name);
         })
         .Sortable()
         .Filterable()
         .DataBinding(dataBinding => dataBinding.Ajax().Select("Select", "Home"))
         .ClientEvents(e => e.OnLoad("onLoad"))
 %>
 <script>
    function onLoad() {
     $(this)
         .find("th .t-grid-filter") //find the filter icon
         .click(function() { // attach a click handler
             setTimeout(function() { // execute the following code after a small delay so the filtering menu is initialized
               $(".t-filter-options:visible option:contains(Ends with)").remove(); //find the Ends with option and remove it
             }, 10);
         });
}
 </script>

Best wishes,
Atanas Korchev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Mike
Top achievements
Rank 1
answered on 08 Nov 2011, 04:44 PM
Hello Atanas,

Thank you very much! This is exectly what I need!

Best Regards!
--Mike 
Tags
Grid
Asked by
Bob Kimbrough
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Mike
Top achievements
Rank 1
Share this question
or