Setting custom grid filter options does not work

5 posts, 0 answers
  1. Andrew
    Andrew avatar
    16 posts
    Member since:
    May 2016

    Posted 13 Oct Link to this post

    Standard grid filtering options done as shown in this demo page: http://demos.telerik.com/aspnet-mvc/grid/filter-menu-customization

    But it doesn't work. Here is my grid:

    @(Html.Kendo().Grid<UserModel>()
        .Name("Items")
        .DataSource(dataSource => dataSource
            .Ajax()
            .Destroy(delete => delete.Action("DeleteGridItem", @ViewContext.RouteData.Values["controller"].ToString()))
            .PageSize(25)
            .Update(update => update.Action("Save", @ViewContext.RouteData.Values["controller"].ToString()))
            //.ServerOperation(true)
            .Sort(sort => sort.Add("Name"))
            .Read(read => read.Action("LoadGrid", @ViewContext.RouteData.Values["controller"].ToString())))
        .ToolBar(tools =>
        {
            tools.Custom().Text("Clear Filter").HtmlAttributes(new { id = "gridAllFilterReset" });
            tools.Excel().Text("Excel");
        })
        .Excel(excel => excel
            .AllPages(true).FileName($"{ViewContext.RouteData.Values["controller"].ToString()}.xlsx").Filterable(true)
        )
        //.EnableCustomBinding(true)
        .Columns(columns =>
        {
            columns.Bound(x => x.Name);
            columns.Bound(x => x.Email);
            columns.Bound(x => x.Departments);
            columns.Bound(x => x.Titles);
            columns.Command(command =>
            {
                command.Custom("Edit").Text("<span class='k-icon k-edit'></span>").Click("editRecord");
                command.Destroy().Text(" ");
            }).Width(250);
        })
        .Filterable(f => f.Operators(o => o.ForString(x => x
                    .Clear()
                    .Contains("Contains")
                    .IsEqualTo("Is Equal To")
                    .StartsWith("Starts With")
                    .EndsWith("Ends With")
                    .DoesNotContain("Does Not Contain")
                    .IsNotEqualTo("Is Not Equal To")
                    .IsEmpty("Is Empty")
                    .IsNotEmpty("Is Not Empty"))))
        .Sortable(x => x.AllowUnsort(false))
        .Pageable()
        .Deferred()
     
    )

     

     

    But when I load the grid, the default filter options for string still apply

  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 18 Oct Link to this post

    Hello Andrew,

    Could you please provide more information about the issue:
       - What actually doesn't work - the filter ui is not properly shown or the filtering operation doesn't work? 
       - Are there any JavaScript errors in the browser console?
       - Is the issue ASP.NET Core specific or it is reproducible in ASP.NET MVC as well?
       - If you are not using latest Kendo UI version, does upgrading to it help?

    Can you bind some dummy data to the grid and then provide it back to us with the controller, so that we can examine the issue further?

    Regards,
    Danail Vasilev
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
  3. Telerik UI for ASP.NET Core is out
  4. Andrew
    Andrew avatar
    16 posts
    Member since:
    May 2016

    Posted 18 Oct Link to this post

    The action of filtering works, options in the filter menu are not what I configured them to be. You see the grid markup for Filterable is applying a certain set of filter options on strings, the order is changed and some are removed from the default filtering options (as in Contains, StartsWith, Is Empty, etc.).

    I've created a test project you see the issue for yourself. It does work if you apply the filterable options to each column, but I don't want to apply that option to every single column on every grid. 

    No javascript console errors. There is in the attached project related to bootstrap and jquery wrong version, but that does not have an impact, in my real project the behavior is identical without that error.

    It is only for the .NET Core version, works fine in the ASP.NET MVC version.

    I have the latest version.

  5. Andrew
    Andrew avatar
    16 posts
    Member since:
    May 2016

    Posted 18 Oct Link to this post

    I didn't realize the attaches were only for images, here is the test project.
  6. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1492 posts

    Posted 20 Oct Link to this post

    Hi Andrew,

    Thank you for sending us a runnable sample.

    I have logged this issue in github, so that you can monitor its progress here - https://github.com/telerik/kendo-ui-core/issues/2346

    I have also updated your Telerik points for helping us improve the quality of our products.

    Regards,
    Danail Vasilev
    Telerik by Progress
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
Telerik UI for ASP.NET Core is out