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

Search box on grid with non string types

3 Answers 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 14 Jan 2021, 08:42 PM

ASP MVC Core grid with the search box enabled.  Per the docs I turned server operation to 'false' and from what I have read this should then allow searching for more that just string types.  In the below example 'PaymentType' is an enum and the search box does not work when searching for that.  It also does not work for the formatted date. 

I could change the datatypes to string but then it might break ordering columns that are DateTime types.

 

    @(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 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 19 Jan 2021, 07:43 PM

Hello Brian,

 

The Search panel input uses the "contains" filter function, therefore, it is generally suitable for string columns. Here you can find its full code:
https://docs.telerik.com/kendo-ui/knowledge-base/grid-search-panel-with-multiple-values

In this sense, you can try either of these options to resolve this:

1. Override the built-in behavior as demonstrated in the KB above

2. Implement your own Search input:
https://docs.telerik.com/kendo-ui/knowledge-base/filter-all-columns-with-one-textbox


 

Regards,
Eyup
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/.

0
Brian
Top achievements
Rank 1
answered on 19 Jan 2021, 07:50 PM

Per the comment from Alex on October 17 2019, I read this as if server filtering is set to false then it should work with all types.  Am I reading this incorrectly?

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

0
Alex Hajigeorgieva
Telerik team
answered on 21 Jan 2021, 09:20 AM

Hi, Brian,

Just a quick note to update the forum thread here.

After further discussion, we have opened a feature request on your behalf that will allow users to search by the text of the enums instead of their values as it is now with ServerOperation(false).

For more information and to upvote the feature request, go to:

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/.

Tags
Grid
Asked by
Brian
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Brian
Top achievements
Rank 1
Alex Hajigeorgieva
Telerik team
Share this question
or