Hi Syncfusion, hi Forum-Readers,
my customer will have a wildcard search in the FilterBar. I've implemented
a SfDataGrid with FilterBar. The FilterBar is configured with "contains", this
works very well ... But my customer will search for the items like 'm%n' so
in the result there is man, men, woman, manufacturer, mendy ...
Can you send me a code snippet or the correct configuration parameters for
the filter, that this works? The placecolder for multiple characters can be %
like in SQL or better *
Alex.
Hi Alexander,
Apologies for the delay and inconvenience caused.
We examined your query and attempted a wildcard search in the SfDataGrid Filterbar. Unfortunately, we do not currently have built-in support for Wildcard filtering.
Kindly get back to us if you have any further queries
Regards,
Sarveswaran PK
Hi Sarveswaran,
do you have an idea to implement such a wildcard service in the SfDataGrid Filterbar.
On server side I have an ODataController ...
Maybe you have a suggestion for some code ....
Regards,
Alex
Hi Alexander,
Sorry for the Inconvenience.
We are currently Validating the reported query with high priority at our end, and we will update the further details within two business days. Until then we appreciate your patience.
Regards,
Sarveswaran PK
Hi Alexander,
We have examined your query and would like to know which platform you would like to implement wildcard filtering, blazor or windows forms. It’ll be more helpful for us to further validate the query and provide the solution as early as possible.
Regards,
Sarveswaran PK
Hi Sarveswaran,
the application is a WebAssembly Blazor Application.
On the server-side we are using ApiControllers or ODataControllers.
Regards, Alex
Hi Alexander,
From your update, we try to create custom sample using two queries contains “startwith” and “endswith” operator to achieve your requirement. We’ll update the further details within two business days.
Until then we appreciate your patience.
Regards,
Sarveswaran PK
Hi Alexander,
Sorry for the delay and inconvenience caused.
We are facing some complexities while creating the custom sample, but we prepared sample based on your requirement to filter data with wildcard. For example in the attached sample we have handled manually for the percentage values “m%n” in filter menu bar using FilterByColumns method. Like this we suggest you to customize your own application at your end. Kindly refer the attached sample and code snippet for your reference.
|
public async Task ActionBeginHandler(ActionEventArgs<Order> args) { if(args.RequestType == Syncfusion.Blazor.Grids.Action.Filtering) { if (String.Equals(args.CurrentFilteringColumn, nameof(Order.CustomerID), StringComparison.OrdinalIgnoreCase) && IsVal) { args.Cancel = true; string val = args.CurrentFilterObject.Value.ToString(); var dataval = val.Split('%'); object value = dataval[0]; if (args.CurrentFilterObject.Operator.Equals(Syncfusion.Blazor.Operator.EndsWith)) { value = dataval[1]; } else { value = dataval[0]; } IsVal = false; await Grid.FilterByColumnAsync("CustomerID", args.CurrentFilterObject.Operator.ToString().ToLower(), value);
}
} // Here, you can customize your code. }
|
Kindly get back to us if you have any further queries.
Regards,
Sarveswaran PK