Answer the question
In order to leave comments, you need to log in
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 );
...
}
$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);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question