Custom Filter Template for Enum Field

2 posts, 0 answers
  1. Neilton
    Neilton avatar
    4 posts
    Member since:
    Aug 2013

    Posted 21 Jan 2015 Link to this post

    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.
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1444 posts

    Posted 23 Jan 2015 Link to this post

    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.

     
Back to Top