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

Custom Filter Template for Enum Field

1 Answer 215 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Neilton
Top achievements
Rank 1
Neilton asked on 21 Jan 2015, 05:25 PM
Hi!

Im using a viewmodel that has an enumeration named "status".
The Grid auto-generates a filter from the enum, which is cool. But I'd like to do 2 things in the grid:
1: Change the enum text
2: Hide some enum options.

I attached a print of the filter with all enum options.

This is my grid:
@(Html.Kendo().Grid<MyViewModel>()
    .Name("grid" + gridName)
    .ToolBar(comands => comands.Template(templateHeader))
    .Columns(columns =>
    {
        columns.Bound(c => c.name).Title("Name");
        columns.Bound(c => c.status).Title("Status");
         }
         .Scrollable()
    .Sortable()
    .Filterable()
    .ColumnMenu(c => c.Messages(m => m.SortAscending("Ordem Ascendente").SortDescending("Ordem Descendente").Columns("Colunas")))
        //.Pageable(pageable => pageable.Input(true).Numeric(false))
    .Resizable(resizable => resizable.Columns(true))
    .DataSource(dataSource => dataSource.Ajax().Read(read => read.Action(action, controller).Data("filtroAdicionalCargasPendentes")))
)

Thanks.

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 23 Jan 2015, 01:47 PM
Hi Joeldo,

This behavior is not supported out of the box, however you can achieve similar results by subscribing to the Grid's filterMenuInit event. Once the event is triggered you can modify the DropDownList's data as necessary.

Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Neilton
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or