We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon DataTables filters case insensitive

Hi,

I'm using this Library and I have a problem with the case insensitive filtering. I have filters input on each columns of my table and I want to ignore the upper case and lower case when I make a search. But the case insensitive filtering by default in this library is true and I want to turn this to false. How can I do this ?

John



1.7k

Your question is not clear, followed the link you put and cannot find what you are refering to...Please be clearer dear.

Sorry for my english !

I created filters input on each table columns and I just want to ignore upper case and lower case when I use the filters input...

This isn't really related to Phalcon... but: SQL tables are usually case insensitive, unless declared as binary. What's your coloumn collation? Are you using server or client side filtering with DataTables?

You should probably start looking around here first.



11.0k

did you use library with server side processing ?

edited Aug '15

With server side. I'm using the ResultSet and the case sensitive is not supported. I tried with the QueryBuilder it works perfectly but I can't use it cause I can't set alias in the select request... And I don't understand how I can join 2 tables. Then I'm using the ResultSet. If you look the library's code you can see in the QueryBuilder :

$this->bind('column_search', function($column, $search) {
  $this->builder->andWhere("{$column} LIKE :key_{$column}:", ["key_{$column}" => "%{$search}%"]);
});

But in the ResultSet there is nothing with "LIKE %"...

edited Jul '16

Hi @Johngtrs. I also had the same problem of case sensitivity when using the ResultSet adapter but was able to solve it by editing the file /DataTables/Adapters/ResultSet.php lines 37 and 48

$check = (strpos($item->$column, $search) !== false);

Change the PHP function strpos (which is case-senstive) to stripos which is case-insensitive.