KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Datatables searching #2669

Open Raul opened this topic on on May 11, 2022 - 13 comments

Raul commented on May 11, 2022

When using the search function in datatables , i am not getting the expected response. Using the demo link and i start to type in "Sales" it does return the proper response. However when I type in "Sales Rep" I don't get anything back.

Keith Burke commented on May 11, 2022

Confirmed. I never noticed before but I have the same problem. Searching for more than one word breaks the search. Probably a buggy regex that doesn't like spaces.

Sebastian Morales commented on May 12, 2022

To search for an exact phrase with blank/tab inside you could use double quotes wrapping the phrase. Let us know if it works for your case. Tks,

Keith Burke commented on May 12, 2022

Yup, that works. Not intuitive for the end user but can work around it. Thanks.

Sebastian Morales commented on May 12, 2022

We use DataTables' default behavior where blank/tab acts as AND operator and add double quotes support for exact phrase searching.

Raul commented on May 12, 2022

When using datatables directly i see a different default behaviour. the search works without quotes. Is there a way to have this work without having users use double quotes? thank you.

Keith Burke commented on May 12, 2022

I believe KoolReport uses DataTables [https://datatables.net/] not CloudTables as per your link above.

Raul commented on May 12, 2022

this link may be a better example. search works without quotes.

Sebastian Morales commented on May 13, 2022

Hi Raul, the demo you provides does work without double quotes but the results are not exactly the same when using and not using quotes.

For example, with search term <e engineer> you get both Support Engineer and Software Engineer rows while with search term <"e engineer"> you only get Software Engineer rows.

In our DataTables widget case, you can search for <sales or rep> i.e having either "sales" or "rep" string, <sales rep> i.e having both "sales" and "rep" strings, or <"sales rep"> i.e having exactly "sales rep" string.

Raul commented on May 13, 2022

thank you for the reply. is it possible to use the default?

Sebastian Morales commented on May 16, 2022

At the moment our DataTables widget uses regular expression search instead of the default smart search of DataTables client. We will add an option for smart search in the next version of Datagrid package. Rgds,

Sebastian Morales commented on May 17, 2022

We've released KoolReport Pro 5.16.2 and Datagrid 7.6.0. You can now enable "smart" searchMode like this:

DataTables::create(array(
    ...
    "searchMode" => "smart",
    ...
));

Pls try it and let us know if it's what you have in mind. Rgds,

vensorelectricals commented on May 17, 2022

informative

Raul commented on May 23, 2022

it works! thank you so much!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved
suggestion

None