Unplanned
Last Updated: 21 Jan 2021 09:18 by ADMIN
Brian
Created on: 19 Jan 2021 19:04
Category: Grid
Type: Feature Request
2
Grid Search Panel with Text instead of Value for enum types

I posted this in the forums but didn't get a response so I'll try here.  Per this link, and other forum posts I thought that when server operations are set to 'false' that non string types would work in the search box for the ASP MVC Core grid.

Documentation:

https://docs.telerik.com/aspnet-core/html-helpers/data-management/grid/search-panel?_ga=2.40480546.1407553043.1611076638-1335478734.1604974711

 

Another forum post reference:

https://www.telerik.com/forums/new-search-panel-and-datetime

 

My grid code is below.  The 'PaymentType' Column is an enum and the search does not work for it.  I have also tried adding this:

 

.Search(search=> { search.Field(f => f.PaymentType); })

 

but it didn't make a difference


    @(Html.Kendo().Grid<B3.Services.LoanServices.LoanServiceModels.PaymentServiceModel>()
        .Name("PaymentRegisterReport")
        .DataSource(dataSource => dataSource
            .Ajax()
            .Read(read => read.Action("Payments_Read", "StandardReports", new { area = "Reports" }))
            .PageSize(1000)
            .ServerOperation(false)
        )
        .Columns(columns =>
        {
            columns.Bound(p => p.Date).Format("{0:MM/dd/yyyy}").Title("Date");
            columns.Bound(p => p.LoanName).Title("Loan Name");
            columns.Bound(p => p.PaymentType).Title("Payment Type");
            columns.Bound(p => p.CheckNumber).Title("Check Number");
            columns.Bound(p => p.Amount).Title("Amount").Format("{0:C}")
                .HtmlAttributes(new { style = "text-align: right" }).HeaderHtmlAttributes(new { style = "text-align: right" });

        })
        .Pageable()
        .Sortable()
        .Filterable()
        .HtmlAttributes(new { style = "font-size:12px" })
        .ColumnMenu()
        .ToolBar(t =>
        {
            t.Search();
            t.Excel();
        })
        .Reorderable(l => l.Columns(true))
        .Events( e =>
        {
            e.ColumnShow("saveKendoGridState");
            e.ColumnHide("saveKendoGridState");
            e.ColumnReorder("kendoGridColumnReorder");
        })
    )

3 comments
ADMIN
Alex Hajigeorgieva
Posted on: 21 Jan 2021 09:18

Hi, Brian,

I have converted to the item to a public feature request and it is available here:

https://feedback.telerik.com/aspnet-core-ui/1502963-grid-search-panel-with-text-instead-of-value-for-enum-types

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Brian
Posted on: 20 Jan 2021 18:38
Yes, feel free to convert it to a thread. For enums I'll just use strings for now.  Thanks for your response.
ADMIN
Alex Hajigeorgieva
Posted on: 20 Jan 2021 16:30

Hi, Brian,

Thank you for letting us know regarding the duplicated question.

The UI for ASP.NET Core forums have up to 72 hours response time so your forum question still has 52 hours before it becomes overdue.

Now, over to your question. The server operations search panel would throw an error because the enum's underlying type is an integral numeric type.  We would face the limitation of Microsoft LINQ that we cannot filter by "Contains" with numbers.

If you use ServerOperations(false) however, there is no error and it will probably surprise you when I tell you that it works. You would get the results if you type in the corresponding number in the search textbox as opposed to the text as we are dealing with text/value pairs.

Here is a Dojo for a quick test with instructions. I tested it with an enum in ASP.NET Core application and I am getting the same result:

https://dojo.telerik.com/eLuZaxAc/3

I have discussed this with the developer who introduced the search panel in the grid and we believe it would make a great addition to the existing functionality. 

Would you like me to convert this thread to a public feature request so others can upvote it?

Look forward to hearing back from you.

Regards,
Alex Hajigeorgieva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.