Grid Searching with special character

Hi,

I found out that the search function is not quite working when the data has special character in it. The documentation page at https://ej2.syncfusion.com/javascript/documentation/grid/searching/ too demonstrates this issue. If you try to search for  "$" it has no result returned. Search for "7" suppose all order dates have "7" in it, but some of them not returned. 

Can anyone assist please?

Thanks!








3 Replies

SK Sujith Kumar Rajkumar Syncfusion Team September 20, 2021 11:12 AM UTC

Hi Swee, 
 
Greetings from Syncfusion support. 
 
Based on the query we would like to let you know that the Grid actions like, searching, filtering, etc., works on basis of the Grid data source and field value bound to each column. So considering searching, the Grid compares the searched value with all the column field data in the underlying data source bound to the grid and returns the result based on that. This is the default behavior of the Grid. 
 
In the documentation link that you mentioned, the ‘$’ is a currency format applied to the ‘Freight’ column and that is not present in the Grid’s data source. So it will not return the result when ‘$’ is searched there. However if the ‘$’ value is present in the data source of the Grid column fields, then it will be returned on search. 
 
You can check this case in the below shared sample where ‘$’ is present in the data source of the Grid column field, 
 
 
Please get back to us if you require any further assistance. 
 
Regards, 
Sujith R 



SS Swee Sin September 20, 2021 01:45 PM UTC

Hi  Sujith,


There is an entry with Order Date =  7/4/1996, however if you try to search "7" or "7/4" this data is not returning. 


In my case, my data has value "WK#37_2021", it returned data when I searched for "WK#" but not when "WK#3", "37" or "37_". 


It just doesn't make sense to me. 


How to go around it?


Thanks!







AG Ajith Govarthan Syncfusion Team September 21, 2021 05:01 PM UTC

Hi Swee Sin, 
 
Thanks for the update. 
 
By default, if you bound the date value, you need to bound the date object. Also, would like to let you know that currently, the Grid does not have support for searching in the date column. This is because the Grid performs the search operation based on the underlying data that is assigned as the Grid’s data source and since the date value is formatted it is not feasible to perform searching on that. This is the default behavior of the Grid based on its current architecture. 
 
So, we suggest bounding string value in your column. By default, Grid can search with contains operator. Please find the screenshot and sample for your reference. 
 
Grid rendered: 
 
 
 
 
Searching 1: 
 
 
 
 
By default, it works with contains operator . So, it returns when the Grid have WK# 
 
 
Searching 2: 
 
 
 
By default, it works with contains operator . So, it returns when the Grid have WK#3 
 
 
Searching 3: 
 
 
 
 
By default, it works with contains operator . So, it returns when the Grid have WK#38 



This is not meet your requirement, could you please explain what you faced issue exactly . Also the share the your data and sample with your issue if it is possible. 

Regards, 

Ajith G. 


Loader.
Up arrow icon