Filtering Issue with Grid Custom Binding

1 Answer 114 Views
Filter Grid
Dharyl
Top achievements
Rank 1
Dharyl asked on 22 Dec 2023, 09:19 AM

Hi, I have this Grid which uses Custom Binding for manual skip and take on the server.

After successful Read of data, my problem now is the Search and Filtering feature is now working.

 

 

@(Html.Kendo().Grid<MyWebApp.Web.Models.ViewModel>()
        .Name("grid")
        .EnableCustomBinding(true)
        .Columns(columns =>
        {
            columns.Bound(p => p.Sorting).Width(100).Filterable(false);
            columns.Bound(p => p.Code).Width(200).Filterable(true);
            columns.Bound(p => p.Description).Filterable(true);
        })
        .ToolBar(toolbar =>
        {
            toolbar.Search();
        })
        .Filterable()
        .Pageable()
        .Sortable()
        .Scrollable(scr => scr.Height(550))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Events(events => events.Error("error_handler"))
            .Model(model => model.Id(p => p.Id))
            .Read("gridDataSource", "Home")
        )
)

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 26 Dec 2023, 07:11 AM

Hi Dharyl,

I noticed that there is no license associated with your account which limits our support service. You can renew or acquire a license. Thus, it would be required to either renew or acquire a new license. The following resource goes more diligently about our available plans:

Regardless, I want to help as much as I can. Handling the filtering explicitly has been shown in the following grid demo:

Within the demo, the ApplyFiltering method receives as an argument a collection of "IFilterDescriptor" items. This interface represents a filtering abstraction that knows how to create a predicate filtering abstraction. For example:

public static IQueryable<OrderViewModel> ApplyOrdersFiltering(this IQueryable<OrderViewModel> data,
           IList<IFilterDescriptor> filterDescriptors)
 {
            if (filterDescriptors.Any())
            {
                data = data.Where(ExpressionBuilder.Expression<OrderViewModel>(filterDescriptors, false));
            }
            return data;
 }

The ExpressionBuilder class provides several methods that are used internally, that you can inspect in the source code to see if an appropriate option suits your needs.

"Notice, that will be applied both for the Search and Filter functionality of the Grid components, as under the curtains, the Search functionality will compose filtering expressions."

I hope this helps.

Kind Regards,
Alexander
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.
Dharyl
Top achievements
Rank 1
commented on 27 Dec 2023, 06:31 AM

Thanks! That helped.
Tags
Filter Grid
Asked by
Dharyl
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or