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

[Solved] Custom Filter UI on column bound to enum type

2 Answers 813 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 17 Sep 2014, 08:45 AM
Hi,

I have mvc grid with column with is bound to enum type. When I use default filter every thing works. But I don't want to show enum member name in dropdown. Ok than I create function with my own dropdown with localized text of enum members, but this function is not called. When I change bound method to with one where I provide type and property name and I choose type of int, my UI function is called but filter not work.

My grid view code is something like this. Type RfsRequestState is enum.
​@(Html.Kendo().Grid(new List<RfsInfoDto>()).Name("table")
  .Filterable(c => c.Enabled(filterStates).Extra(false))
  .Columns(column =>{ 
    column.Bound(c => c.Id).Title(IndexResources.IdColumnName).Filterable(false);
   column.Bound(typeof(RfsRequestState), "StreamState").Title(IndexResources.StatusColumnName).Filterable(c => c.Enabled(true).UI("stateFilterUi").Extra(false)));
  }))

what is correct way to use custom filter ui on enum property

Thanks

2 Answers, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 19 Sep 2014, 07:31 AM
Hello Martin,

The function is not invoked because as described in the documentation when the VALUES for the column are provided the UI function won't be invoked:

http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.filterable.ui

When an Enum or ForeignKey column is created through the MVC wrappers then the values field for that column isautomatically populated with the needed items.

Kind Regards,
Petur Subev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Martin
Top achievements
Rank 1
answered on 19 Sep 2014, 01:39 PM
Thank you. When I use ForeignKey instead of Bound column, I can provide my custom text for enum members.
Tags
Grid
Asked by
Martin
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Martin
Top achievements
Rank 1
Share this question
or