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

Setting custom grid filter options does not work

4 Answers 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 13 Oct 2016, 04:44 PM

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

4 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 18 Oct 2016, 02:23 PM
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
0
Andrew
Top achievements
Rank 1
answered on 18 Oct 2016, 08:29 PM

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.

0
Andrew
Top achievements
Rank 1
answered on 18 Oct 2016, 08:35 PM
I didn't realize the attaches were only for images, here is the test project.
0
Danail Vasilev
Telerik team
answered on 20 Oct 2016, 11:12 AM
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
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Andrew
Top achievements
Rank 1
Share this question
or