Please pass the search[caseInsensitive] over to the server-side processing

Please pass the search[caseInsensitive] over to the server-side processing

summeresummere Posts: 3Questions: 1Answers: 0
edited August 2014 in Free community support

Hello-

I am using DataTables via shiny. The tables look nice, work quickly and are easy to setup and use, thanks! Sadly, the people at shiny say they are unable to provide case-insensitive searching, rendering the tables pretty much useless.

Here is what shiny had to say:

"I cannot do much on shiny's side unless DataTables passes the info search[caseInsensitive] over to the server-side processing: https://datatables.net/manual/server-side Currently it only passes search[value] and search[regex]."

Are there any work arounds for this, aside from making everything in my tables lower case?

Thanks so much,
Summer

Answers

  • allanallan Posts: 62,944Questions: 1Answers: 10,356 Site admin

    Can you not just modify the Shiny code to make all searches case insensitive? In Postgres you would use ILIKE rather than LIKE for example.

    Allan

  • yihuiyihui Posts: 2Questions: 0Answers: 0

    I'm the author of Shiny who is in charge of the DataTables integration. I can certainly make search case-insensitive in Shiny by hard-coding the value of this parameter, but it is just a bad idea: what if the user wants case-sensitive searching? Then there is no way back. By comparison, the current case-sensitive searching in Shiny can be made case-insensitive by using regular expressions, e.g. a search string [Aa][Bb][Cc], although it is very awkward.

    I do not see why the server-side processing should not pass search[caseInsensitive] along with search[value] and search[regex]. The server needs to know this piece of information to decide whether the searching should be case-insensitive or not.

  • summeresummere Posts: 3Questions: 1Answers: 0

    I agree! These are two great tools, and a very commonly used and necessary feature for both. It would be great to get it working!

  • allanallan Posts: 62,944Questions: 1Answers: 10,356 Site admin

    Thanks for the feedback.

    Interestingly this is the first time I've seen a request for this specific information to be sent to the server. So its not something I'm going to put into the DataTables core at the moment, but I would invite anyone else interested in this to also post a comment here supporting the addition of this information.

    Indeed, the most common request I've about about this area of the code is to reduce the information being sent to the server for the columns (i.e. remove the regex flag). This is partly because of the default use of GET (I should have used default POST, but can't change it now!).

    in the mean time, if you do require this information you could use ajax.data to modify the data being sent to the server and and add information about the case sensitivity.

    Regards,
    Allan

  • yihuiyihui Posts: 2Questions: 0Answers: 0
    edited August 2014

    Thanks for the pointer to ajax.data, and I have got a workaround for this issue now. While I was working on this, I have got a new issue: I cannot find bCaseSensitive from DT.settings(), so it is not possible to dynamically read the setting. This is not a big issue, though.

  • summeresummere Posts: 3Questions: 1Answers: 0

    Yay! Thanks to you both!

This discussion has been closed.