E
E
EVOSandru62016-06-30 06:42:13
PostgreSQL
EVOSandru6, 2016-06-30 06:42:13

How to build a case-insensitive search model for the grid in Yii1?

Good afternoon,
By default, the search in the grid is case-sensitive:

public function search() {
     $criteria->compare('t.name',				$this->name		, true		);
     ...
}

Tried adding options like this:
$criteria->addSearchCondition('t.name', '%'.$this->name.'%', false, 'AND', 'ILIKE');
$criteria->addSearchCondition('name', $this->name, true, 'AND', 'ILIKE');
$criteria->compare('LOWER(name)',strtolower($this->name),true);
$criteria->compare('name', 		strtoupper($model->name), 				true);
$criteria->compare('name', 		strtolower($model->name), 				true);
$criteria->compare('name', 		mb_strtoupper($model->name, 'UTF-8'), 	true);

But in vain.. As a database - Postgres

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question