Matus Vacula
Matus Vacula

Reputation: 31

Yii CGridView Filter

I want CGridView's filter to work with multiple words in one column at the time. For example i want to show all rows with "A" in first column plus all the rows with "B" in the same column.

Does anybody know which class and function should i override to do this?

Upvotes: 3

Views: 2175

Answers (1)

Mukesh Soni
Mukesh Soni

Reputation: 6668

You will have to modify the search() function in your model. The search() function will have something like this -

    $criteria->compare('your_column_name', $this->your_column_name, true);

you can modify it by breaking the input, which is in $this->your_column_name and adding one compare condition for each of the elements in the input. You can use explode() to break the string into multiple terms.

Upvotes: 4

Related Questions