Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 2.24 KB

Searching.md

File metadata and controls

47 lines (34 loc) · 2.24 KB

Blazor client-side

Searching

Index

You can enable the searching option for your grid. Searching allows to search for a text on all columns at the same time.

You can enable searching for all columns of a grid using the Searchable method for both GridClient and GridServer objects:

  • Client project

        var client = new GridClient<Order>(httpClient, url, query, false, "ordersGrid", Columns, locale)
            .Searchable(true, false, true);
  • Server project

        var server = new GridServer<Order>(repository.GetAll(), Request.Query, true, "ordersGrid", columns, 10)
            .Searchable(true, false, true);

Searching parameters

Parameter Description Example
enable (optional) bool to enable searching on the grid Searchable(true, ...)
onlyTextColumns (optional) bool to enable searching on all collumns or just on string ones Searchable(..., true, ...)
hiddenColumns (optional) bool to enable searching on hidden columns Searchable(..., true)

enable default value is true, onlyTextColumns default value is true, and hiddenColumns default value is false.

Searching on boolean columns has benn disabled because EF Core 3.0 is not supporting it yet.

IMPORTANT: If you get an InvalidOperationException while searching with a message similar to:

Error generated for warning 'Microsoft.EntityFrameworkCore.Query.QueryClientEvaluationWarning: The LINQ expression 'where ...' could not be translated and will be evaluated locally.'. This exception can be suppressed or logged by passing event ID 'RelationalEventId.QueryClientEvaluationWarning' to the 'ConfigureWarnings' method in 'DbContext.OnConfiguring' or 'AddDbContext'.

Then you must enable query client evaluation on the ORM (EF Core). You can enable it adding the following line to the Startup.cs file:

    options.ConfigureWarnings(warnings => warnings.Ignore(RelationalEventId.QueryClientEvaluationWarning)); 

Keep in mind that enabling query client evaluation on the ORM (EF Core) can have a big impact on performance.

<- Selecting row | Filtering ->